shibatch / sleef

SIMD Library for Evaluating Elementary Functions, vectorized libm and DFT
https://sleef.org
Boost Software License 1.0
635 stars 129 forks source link

FP64 tan_u10 returns wrong sign for input `-0x1p-1074` #466

Open ebavier opened 1 year ago

ebavier commented 1 year ago

As a special case of #465, Sleef_tan_u10 returns positive 0.0 for input -0x1p-1074. In addition to this result being greater than 1.0 ulp in error, it also has the wrong sign.

The attached tan-test-2.zip contains a reproducer, whose output is:

tan_10(-0x0.0000000000001p-1022) = 0x0.0000000000000p+0
tan_10(-0x0.0000000000001p-1022) = 0x0.0000000000000p+0
tan_10(-0x0.0000000000001p-1022) = 0x0.0000000000000p+0
tan_10(-0x0.0000000000001p-1022) = 0x0.0000000000000p+0
tan_10(-0x0.0000000000001p-1022) = 0x0.0000000000000p+0
tan_10(-0x0.0000000000001p-1022) = 0x0.0000000000000p+0
tan_10(-0x0.0000000000001p-1022) = 0x0.0000000000000p+0
tan_10(-0x0.0000000000001p-1022) = 0x0.0000000000000p+0
tan_10(-0x0.0000000000001p-1022) = 0x0.0000000000000p+0
tan_10(-0x0.0000000000001p-1022) = 0x0.0000000000000p+0
MPFR faithful results = -0x0.0000000000002p-1022, -0x0.0000000000001p-1022