This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug math/24622] powl function inaccurate for x86/x86_64


https://sourceware.org/bugzilla/show_bug.cgi?id=24622

--- Comment #8 from agner at agner dot org <agner at agner dot org> ---
Thank you very much for making a test program for this.

It appears that the error occurs only when running Ubuntu as a subsystem under
Windows (WSL). It claims to be a genuine Ubuntu, and it appears to be - except
for the powl bug.

My configuration:

uname -a
Linux DESKTOP-08PNUTF 4.4.0-17763-Microsoft #379-Microsoft Wed Mar 06 19:16:00
PST 2019 x86_64 x86_64 x86_64 GNU/Linux

gcc --version
gcc (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0

libc version 2.27

Result of Adhemerval's test program:
------------------------------------

a = 2.8016;
b = 512;
is:          1.18015191259917123727e+229   0xf.9164a0cd59578000p+757
should be:   1.18015191259911930651e+229   0xf.9164a0cd5896ad70p+757
difference:  5.19307574397350868049e+215   0xc.0d29000000000000p+713
ulp       :  789801.0000

a = 9.5952957579581444E-01;
b = -1.6994966845030955E+04;
Result:
is:          8.26953694309959887315e+304   0xf.12d43863a5898000p+1009
should be:   8.26953694308439751375e+304   0xf.12d4386387122ec0p+1009
difference:  1.52013593940156453233e+293   0xf.3ba8a00000000000p+970
ulp       :  31946004.0000


I tried to test powl in various other sytems:

Clean Ubuntu installation: powl is accurate
Mingw64: powl is accurate
Cygwin64: powl is accurate
Ubuntu in Windows Subsystem for Linux: powl is inaccurate!


My apologies for not reporting the complete system configuration. I believed
the claim that it was a genuine Ubuntu, and in all other respects it appears to
be.

Is there a fork of glibc somewhere, and who is responsible for it? Or is it a
configuration error?

The little test program i attached calculates a special case of powl(x,y) where
y is a power of 2. This makes the exact calculation very simple. In the other
test cases I reported, I calculated the reference value by splitting y into an
integer part and a fraction. I get basically the same results as your test
program, but of course a mpfr is better.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]