"rsobies" <rsobies@discussions.microsoft.com> wrote in message
news:98A4CEFF-9553-41D3-AC4B-3B626F538FF0@microsoft.com
look at that pice of code:
double rr(double value)
{
double value_s=value/0.01+0.5;
return value_s;
}
double value1=rr(15.0*125456.5/100.0) //18818.475
dobule value2=rr((2.5+4.0)*63135.0/100.0) //4103.775
double value3=rr((35.0/100.0)*35200.5) //12320.175
value1:=1881847.9999999998 //incorrect
value2:=410377.9999999994 //incorrect
value3:=1232018.00000 //correct
All values look correct to me. You get a 15 significant digits or higher
accuracy - quite good. I realize you are expecting a mathematically exact
answer, but you are not going to get it most of the time when working with
floating point values. For more details, see
http://blogs.sun.com/darcy/resource/Wecpskafpa-ACCU.pdf
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925