Adding *float + float seems to be not possible. [egcs-2.91.66]

Michal Bartczak mikerro@ihh.pi.com.pl
Thu Dec 23 06:54:00 GMT 1999


gcc version:
egcs-2.91.66
system type:
red-hat 6.0
Linux 2.2.5-15 i686 unknown (pentium II)

options for compiler:
gcc -Wall <source_name> -lm ;)

Sources included. Output is:
/*************** snip   *****************/
2, 0.000000, mult=10.000000  whole:2.000000
2, 2.000000, mult=10.000000  whole:22.000000
Dot 1, 22.000000, mult=10.000000  whole:(Adding 0.100000 * 1.000000 = 0.100000)  Adding 22.000000 + 0.100000 = 22.100000   22.100000
Dot 1, 22.100000, mult=100.000000  whole:(Adding 0.010000 * 1.000000 = 0.010000)  Adding 22.100000 + 0.010000 = 22.110001   22.110001
/* rest is not important, because bug is visible here */

how can be 22.1 + 0.01 = 22.110001 ? Accumulating error? 

This is repeatable on PowerPC egcs too :P (old egcs 1.0.2 - prerelease) 
[Linux 2.0.33 - osfmach3, ppc unknown (604)]

or maybe I'm doing something stupid. ?

Michal Bartczak

-------------- next part --------------
A non-text attachment was scrubbed...
Name: tig.ps
Type: application/postscript
Size: 65 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/19991223/310b5428/attachment.ps>


More information about the Gcc-bugs mailing list