Fix x86_64/x86 powl handling of sNaN arguments (bug 20916).
commita91fd168a0db38563528dab1a13180fda2a5040c
authorJoseph Myers <joseph@codesourcery.com>
Tue, 6 Dec 2016 00:33:19 +0000 (6 00:33 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Tue, 6 Dec 2016 00:33:19 +0000 (6 00:33 +0000)
tree9635f8f07429b3509688928500d91de84939529d
parentca6e601a9d4a72b3699cca15bad12ac1716bf49a
Fix x86_64/x86 powl handling of sNaN arguments (bug 20916).

The x86_64/x86 powl implementations mishandle sNaN arguments, both by
returning sNaN in some cases (instead of doing arithmetic on the
arguments to produce the result when NaN arguments result in NaN
results) and by treating sNaN the same as qNaN for arguments (1, sNaN)
and (sNaN, 0), contrary to TS 18661-1 which requires those cases to
return qNaN instead of 1.

This patch makes the x86_64/x86 powl implementations follow TS 18661-1
semantics for sNaN arguments; sNaN tests are also added for pow.
Given the problems with testing float and double sNaN arguments on
32-bit x86 (sNaN tests disabled because the compiler may convert
unnecessarily to a qNaN when passing arguments), no changes are made
to the powf and pow implementations there.

Tested for x86_64 and x86.

[BZ #20916]
* sysdeps/i386/fpu/e_powl.S (__ieee754_powl): Do not return 1 for
arguments (sNaN, 0) or (1, sNaN).  Do arithmetic on NaN arguments
to compute result.
* sysdeps/x86_64/fpu/e_powl.S (__ieee754_powl): Likewise.
* math/libm-test.inc (pow_test_data): Add tests of sNaN arguments.
ChangeLog
math/libm-test.inc
sysdeps/i386/fpu/e_powl.S
sysdeps/x86_64/fpu/e_powl.S