On Wednesday, September 05, 2007 Simon Davies wrote: > [...] > This resolves down to calling a function vxprintf, which has the following > line:
> while( realvalue>=10.0 && exp<=350 ){ realvalue *= 0.1; exp++; } > When this line is reached, realvalue has value 98926650.5 and exp value 0. > realvalue then goes the following values during the loop: > 9892665.0500000007 > 989266.50500000012 > 98926.650500000018 > 9892.6650500000032 > 989.26650500000039 > 98.926650500000051 > 9.8926650500000051 > exp finishes at 7 > Note the 'error' added in by the successive multiplications is 0.000000051 > [...] > One wonders why XP/VC++ produces such a large error in its floating > point manipulations that appears to be avoided by other compilers. ...probably because VC++ uses 64 bits for long double (53 bit mantissa) whereas gcc uses 96 bits (64 bit mantissa). Note that realvalue above is declared as LONGDOUBLE_TYPE (long double). http://msdn2.microsoft.com/en-us/library/9c3yd98k(VS.80).aspx http://msdn2.microsoft.com/en-us/library/9cx8xs15(vs.80).aspx e -- Doug Currie Londonderry, NH, USA ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------