Why do sin(45) and cos(45) give different results? [duplicate]
问题 This question already has answers here : Is floating point math broken? (31 answers) Closed 4 years ago . This is something I wasn't expecting. I know these numbers are not 100% exact, but I wasn't expecting complementary angles giving different results of sin and cos : This following function returns 0.70710678118654746000000... sin(45 * PI / 180.0); while this follwing function returns 0.70710678118654757000000... cos(45 * PI / 180.0); so, it's: 0.707106781186547**46**000000... vs 0