log2() bug

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

log2() bug

Hi all,
I've discovered that the math.h log2() function
is producing erroneous results. Try the following
test and you'll see, log2(8) does not produce 3,
but rather it gives 1.44. The regular log() function
works however, as it gives log(8)=2.08.

#include <math.h>
#include <windows.h>
#include <stdio.h>
main ()
        double d = 8.;
        d = log2 (d);
        wchar_t foo[100];
        swprintf (foo, L"%g", d);
        MessageBoxW (0, foo, 0,0);

Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
Cegcc-devel mailing list
[hidden email]