Do only double precision arithmetic. It's getting rounded if you convert to single precision.
Note that most implementations of C and C++ don't do a good job of casting single to double - that's why:Code:const double g=.0000000000667; double whatever, result float someval; result = whatever * g * convert(someval);
Code:double convert(float in){ double tmp; char start[25], *end; memset(start,0x00, sizeof(start)); sprintf(start,"%f",in); end=s; return strtod(s,&end); }




Reply With Quote