AnsweredAssumed Answered

numeric problem

Question asked by Milos on Mar 25, 2010
Latest reply on Mar 31, 2010 by Milos

Hi,

 

I need to solve this problem on ADSP 21369

compiler is set to 64-bit IEEE floating point

 

 

double a=1.287572492320042e-008;  //in hex 3e4ba6812fbae182

double b, c, d, e;

 

 

b=cos(a);   //  result is 1.0   or in hex = 3FF00000 0000000

                 //  but right is 1.000000000000000  or in hex  3fefffffffffffff

 

c=(1-b);     //  result is 0.0   or in hex = 00000000 0000000

                //  but right is 1.110223024625157e-016 or in hex  3ca0000000000000

 

d= a*a;   // result is 1.657842922979246e-016 or in hex = 3ca7e45c5ee41889

              // this result is OK

 

BUT

 

e= c/d;  // result is 0.0   or in hex = 00000000 0000000

            //  but right is 0.669679261669747 or in hex  3fe56e0333f5caac

 

There is big difference in result

Can you help me?

 

Best Regards,

Milos

Outcomes