bulloid
March 15th, 2012, 11:24 AM
Hello everbody,
I am currently porting Matlab codes to C. Due to the purpose of the program, I need a very high precision of more than 1e-12. However, with the sin and cos functions from math.h in C, I can't get the same result as in Matlab and the difference is at the order of 1e-10. Below is the calculation that I am doing.
a = 6371009
b = 8.377580409572781e-001
a*sin(b)
The result that I obtained with math.h differs from the result with Matlab by -9.313225746154785e-010
Does anybody know any library for C program with has trigonometric functions comparable to those of Matlab?
Thank you for your help!
I am currently porting Matlab codes to C. Due to the purpose of the program, I need a very high precision of more than 1e-12. However, with the sin and cos functions from math.h in C, I can't get the same result as in Matlab and the difference is at the order of 1e-10. Below is the calculation that I am doing.
a = 6371009
b = 8.377580409572781e-001
a*sin(b)
The result that I obtained with math.h differs from the result with Matlab by -9.313225746154785e-010
Does anybody know any library for C program with has trigonometric functions comparable to those of Matlab?
Thank you for your help!