Floating point accuracy with different languages
问题 I'm currently doing distance calculations between coordinates and have been getting slightly different results depending on the language used. Part of the calculation is taking calculating the cosine of a given radian . I get the following results // cos(0.8941658257446736) // 0.6261694290123146 node // 0.6261694290123146 rust // 0.6261694290123148 go // 0.6261694290123148 python // 0.6261694290123148 swift // 0.6261694290123146 c++ // 0.6261694290123146 java // 0.6261694290123147 c I would