# cw v6.2 math precision

Discussion created by guillaume sanahuja on May 6, 2009
Latest reply on Mar 30, 2011 by Jim Potteabaum

Hello,

I'm working with cw 6.2, and trying do make some trigonometric calculations. The target is a MCF51qe.

For exemple, when I do this:

sin((double)0.86217507327430);

I obtain 0.75926020631887015.

In matlab, the same sinus gives 0.75925986842193.

The difference is not so big, but I have difference for each sin/cos calculation, and the result is used to found the distance between 2 GPS points. The distance is given using an acos function but the argument of the acos is >1, due to precision problems; so it can't be calculated. I'm sure of the formulas I'm using, as I checked with a computer and the problem doesn't appear (argument of acos is always<1).

In cw, I have included this libs:

fp_coldfire_nodiv.a

C_4i_CF_RegABI_MATH_MSL.a

C_4i_CF_RegABI_Runtime.a

I've tried other libs but without success.

Someone has an idea?