Floating point problem on glibc-2.1.1

Tung-Han Hsieh thhsieh@linux.org.tw
Mon May 3 06:26:00 GMT 1999


Hello,

We discover a floating point problem on glibc-2.1.1:

#include <math.h>
#include <stdio.h>

main()
{
    printf("%d\n", (int)(log(8.0)/log(2.0)));
}


When compile this simple program with command:

	cc file.c -lm

and run it, the output is "2", but not "3"; while in other plateforms,
say, Solaries-2.5.1, the output is "3".

This problem also exists in glibc-2.0.7.


Best Regards,

T.H.Hsieh



More information about the Libc-alpha mailing list