| Age | Commit message (Collapse) | Author | Files | Lines |
|
C23 adds various <math.h> function families originally defined in TS
18661-4. Add the pown functions, which are like pow but with an
integer exponent. That exponent has type long long int in C23; it was
intmax_t in TS 18661-4, and as with other interfaces changed after
their initial appearance in the TS, I don't think we need to support
the original version of the interface. The test inputs are based on
the subset of test inputs for pow that use integer exponents that fit
in long long.
As the first such template implementation that saves and restores the
rounding mode internally (to avoid possible issues with directed
rounding and intermediate overflows or underflows in the wrong
rounding mode), support also needed to be added for using
SET_RESTORE_ROUND* in such template function implementations. This
required math-type-macros-float128.h to include <fenv_private.h>, so
it can tell whether SET_RESTORE_ROUNDF128 is defined. In turn, the
include order with <fenv_private.h> included before <math_private.h>
broke loongarch builds, showing up that
sysdeps/loongarch/math_private.h is really a fenv_private.h file
(maybe implemented internally before the consistent split of those
headers in 2018?) and needed to be renamed to fenv_private.h to avoid
errors with duplicate macro definitions if <math_private.h> is
included after <fenv_private.h>.
The underlying implementation uses __ieee754_pow functions (called
more than once in some cases, where the exponent does not fit in the
floating type). I expect a custom implementation for a given format,
that only handles integer exponents but handles larger exponents
directly, could be faster and more accurate in some cases.
I encourage searching for worst cases for ulps error for these
implementations (necessarily non-exhaustively, given the size of the
input space).
Tested for x86_64 and x86, and with build-many-glibcs.py.
|
|
|
|
C23 adds various <math.h> function families originally defined in TS
18661-4. Add the powr functions, which are like pow, but with simpler
handling of special cases (based on exp(y*log(x)), so negative x and
0^0 are domain errors, powers of -0 are always +0 or +Inf never -0 or
-Inf, and 1^+-Inf and Inf^0 are also domain errors, while NaN^0 and
1^NaN are NaN). The test inputs are taken from those for pow, with
appropriate adjustments (including removing all tests that would be
domain errors from those in auto-libm-test-in and adding some more
such tests in libm-test-powr.inc).
The underlying implementation uses __ieee754_pow functions after
dealing with all special cases that need to be handled differently.
It might be a little faster (avoiding a wrapper and redundant checks
for special cases) to have an underlying implementation built
separately for both pow and powr with compile-time conditionals for
special-case handling, but I expect the benefit of that would be
limited given that both functions will end up needing to use the same
logic for computing pow outside of special cases.
My understanding is that powr(negative, qNaN) should raise "invalid":
that the rule on "invalid" for an argument outside the domain of the
function takes precedence over a quiet NaN argument producing a quiet
NaN result with no exceptions raised (for rootn it's explicit that the
0th root of qNaN raises "invalid"). I've raised this on the WG14
reflector to confirm the intent.
Tested for x86_64 and x86, and with build-many-glibcs.py.
|
|
C23 adds various <math.h> function families originally defined in TS
18661-4. Add the rsqrt functions (1/sqrt(x)). The test inputs are
taken from those for sqrt.
Tested for x86_64 and x86, and with build-many-glibcs.py.
|
|
The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows better performance to the generic atanpif.
The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).
Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1):
latency master patched improvement
x86_64 66.3296 52.7558 20.46%
x86_64v2 66.0429 51.4007 22.17%
x86_64v3 60.6294 48.7876 19.53%
aarch64 (Neoverse) 24.3163 20.9110 14.00%
power8 16.5766 13.3620 19.39%
power10 16.5115 13.4072 18.80%
reciprocal-throughput master patched improvement
x86_64 30.8599 16.0866 47.87%
x86_64v2 29.2286 15.4688 47.08%
x86_64v3 23.0960 12.8510 44.36%
aarch64 (Neoverse) 15.4619 10.6752 30.96%
power8 7.9200 5.2483 33.73%
power10 6.8539 4.6262 32.50%
Reviewed-by: DJ Delorie <dj@redhat.com>
|
|
The logic was copied wrong from CORE-MATH.
|
|
The logic was copied wrong from CORE-MATH.
|
|
It was copied wrong from CORE-MATH.
|
|
More routines are to follow, some of which hit many failures in the
current testsuite due to wrong sign of zero (mathvec routines are not
required to get this right). Instead of disabling a large number of
tests, change the failure condition such that, for vector routines,
tests pass as long as computed == expected == 0.0, regardless of sign.
Affected tests (vector tests for expm1, log1p, sin, tan and tanh) all
still pass.
|
|
These inputs were generated with the programs from
https://gitlab.inria.fr/zimmerma/math_accuracy,
with rounding to nearest:
* for univariate binary32 functions by exhaustive search
* for other functions with the "threshold" parameter up to 10^6
|
|
|
|
On powerpc math/test-ibm128-tanpi shows multiple failures:
testing long double (without inline functions)
Failure: tanpi_downward (0xfffffffffffffffdp-1): Exception "Divide by zero" not set
Failure: tanpi_downward (0xfffffffffffffffdp-1): errno set to 0, expected 34 (ERANGE)
Failure: Test: tanpi_downward (0xfffffffffffffffdp-1)
Result:
is: 4.68843873182857939141363635204365e+28 0x1.2efbb6629d1d59b032520400df8p+95
should be: inf inf
Failure: tanpi_downward (0x3fffffffffffffffffffffffffdp-1): Exception "Divide by zero" not set
Failure: tanpi_downward (0x3fffffffffffffffffffffffffdp-1): errno set to 0, expected 34 (ERANGE)
Failure: Test: tanpi_downward (0x3fffffffffffffffffffffffffdp-1)
Result:
is: 1.41444453325831960404472183124793e+16 0x1.9202627cbf98e052d5fdbeee1f8p+53
should be: inf inf
Failure: tanpi_downward (-0xf.ffffffffffffbffffffffffffcp+1020): Exception "Invalid operation" set
Failure: tanpi_downward (-0xf.ffffffffffffbffffffffffffcp+1020): Exception "Overflow" set
Failure: tanpi_downward (-0xf.ffffffffffffbffffffffffffcp+1020): errno set to 33, expected 0 (unchanged)
Failure: Test: tanpi_downward (-0xf.ffffffffffffbffffffffffffcp+1020)
Result:
is: qNaN
should be: -0.00000000000000000000000000000000e+00 -0x0.000000000000000000000000000p+0
Failure: Test: tanpi_downward (0x3.fffffffffffffffcp+108)
Result:
is: 2.91356019227449116879287504834896e-15 0x1.a3e365fee24d4632f95a2235698p-49
should be: 0.00000000000000000000000000000000e+00 0x0.000000000000000000000000000p+0
difference: 2.91356019227449116879287504834896e-15 0x1.a3e365fee24d4632f95a2235698p-49
ulp : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321
max.ulp : 8.0000
Failure: Test: tanpi_downward (0x3.ffffffffffffffffffffffffffp+108)
Result:
is: 7.94911926685664643005642781870827e-16 0x1.ca3c4b83eb5688e1474146dc338p-51
should be: 0.00000000000000000000000000000000e+00 0x0.000000000000000000000000000p+0
difference: 7.94911926685664643005642781870827e-16 0x1.ca3c4b83eb5688e1474146dc338p-51
ulp : 160891965142034222272327839154722485473479235229008379884749401713481320342777314570400076204240982703218835644458374555276642
max.ulp : 8.0000
Failure: tanpi_towardzero (0xfffffffffffffffdp-1): Exception "Divide by zero" not set
Failure: tanpi_towardzero (0xfffffffffffffffdp-1): errno set to 0, expected 34 (ERANGE)
Failure: Test: tanpi_towardzero (0xfffffffffffffffdp-1)
Result:
is: 2.14718475310122677917055904836884e+28 0x1.1584624c14882fff76592b4ec10p+94
should be: inf inf
Failure: tanpi_towardzero (-0xfffffffffffffffdp-1): Exception "Divide by zero" not set
Failure: tanpi_towardzero (-0xfffffffffffffffdp-1): errno set to 0, expected 34 (ERANGE)
Failure: Test: tanpi_towardzero (-0xfffffffffffffffdp-1)
Result:
is: -2.14718475310122677917055904836884e+28 -0x1.1584624c14882fff76592b4ec10p+94
should be: -inf -inf
Failure: tanpi_towardzero (0x3fffffffffffffffffffffffffdp-1): Exception "Divide by zero" not set
Failure: tanpi_towardzero (0x3fffffffffffffffffffffffffdp-1): errno set to 0, expected 34 (ERANGE)
Failure: Test: tanpi_towardzero (0x3fffffffffffffffffffffffffdp-1)
Result:
is: 6.60739946234609289593176521179840e+15 0x1.7796511d79d6ce55bc8bf083fe0p+52
should be: inf inf
Failure: tanpi_towardzero (-0x3fffffffffffffffffffffffffdp-1): Exception "Divide by zero" not set
Failure: tanpi_towardzero (-0x3fffffffffffffffffffffffffdp-1): errno set to 0, expected 34 (ERANGE)
Failure: Test: tanpi_towardzero (-0x3fffffffffffffffffffffffffdp-1)
Result:
is: -6.60739946234609289593176521179840e+15 -0x1.7796511d79d6ce55bc8bf083fe0p+52
should be: -inf -inf
Failure: Test: tanpi_towardzero (-0x3.fffffffffffffffcp+108)
Result:
is: -1.17953443892757434921819283936141e-14 -0x1.a8f8d97fb893518cbe5688935c0p-47
should be: -0.00000000000000000000000000000000e+00 -0x0.000000000000000000000000000p+0
difference: 1.17953443892757434921819283936141e-14 0x1.a8f8d97fb893518cbe5688935c0p-47
ulp : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321
max.ulp : 8.0000
Failure: Test: tanpi_towardzero (-0x3.ffffffffffffffffffffffffffp+108)
Result:
is: -1.85584803206881692897837494734542e-14 -0x1.4e51e25c1f5ab4470a3a0a42c24p-46
should be: -0.00000000000000000000000000000000e+00 -0x0.000000000000000000000000000p+0
difference: 1.85584803206881692897837494734542e-14 0x1.4e51e25c1f5ab4470a3a0a42c24p-46
ulp : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321
max.ulp : 8.0000
Failure: Test: tanpi_towardzero (0x3.fffffffffffffffcp+108)
Result:
is: 1.17953443892757434921819283936141e-14 0x1.a8f8d97fb893518cbe5688935c0p-47
should be: 0.00000000000000000000000000000000e+00 0x0.000000000000000000000000000p+0
difference: 1.17953443892757434921819283936141e-14 0x1.a8f8d97fb893518cbe5688935c0p-47
ulp : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321
max.ulp : 8.0000
Failure: Test: tanpi_towardzero (0x3.ffffffffffffffffffffffffffp+108)
Result:
is: 1.85584803206881692897837494734542e-14 0x1.4e51e25c1f5ab4470a3a0a42c24p-46
should be: 0.00000000000000000000000000000000e+00 0x0.000000000000000000000000000p+0
difference: 1.85584803206881692897837494734542e-14 0x1.4e51e25c1f5ab4470a3a0a42c24p-46
ulp : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321
max.ulp : 8.0000
Failure: tanpi_upward (-0xfffffffffffffffdp-1): Exception "Divide by zero" not set
Failure: tanpi_upward (-0xfffffffffffffffdp-1): errno set to 0, expected 34 (ERANGE)
Failure: Test: tanpi_upward (-0xfffffffffffffffdp-1)
Result:
is: -2.14718475310122677917055904836884e+28 -0x1.1584624c14882fff76592b4ec10p+94
should be: -inf -inf
Failure: tanpi_upward (-0x3fffffffffffffffffffffffffdp-1): Exception "Divide by zero" not set
Failure: tanpi_upward (-0x3fffffffffffffffffffffffffdp-1): errno set to 0, expected 34 (ERANGE)
Failure: Test: tanpi_upward (-0x3fffffffffffffffffffffffffdp-1)
Result:
is: -6.60739946234609289593176521179829e+15 -0x1.7796511d79d6ce55bc8bf083fdbp+52
should be: -inf -inf
Failure: Test: tanpi_upward (-0x3.fffffffffffffffcp+108)
Result:
is: -1.17953443892757434921819283936138e-14 -0x1.a8f8d97fb893518cbe5688935b0p-47
should be: -0.00000000000000000000000000000000e+00 -0x0.000000000000000000000000000p+0
difference: 1.17953443892757434921819283936139e-14 0x1.a8f8d97fb893518cbe5688935b0p-47
ulp : inf
max.ulp : 8.0000
Failure: Test: tanpi_upward (-0x3.ffffffffffffffffffffffffffp+108)
Result:
is: -1.85584803206881692897837494734542e-14 -0x1.4e51e25c1f5ab4470a3a0a42c24p-46
should be: -0.00000000000000000000000000000000e+00 -0x0.000000000000000000000000000p+0
difference: 1.85584803206881692897837494734543e-14 0x1.4e51e25c1f5ab4470a3a0a42c24p-46
ulp : inf
max.ulp : 8.0000
Failure: tanpi_upward (0xf.ffffffffffffbffffffffffffcp+1020): Exception "Invalid operation" set
Failure: tanpi_upward (0xf.ffffffffffffbffffffffffffcp+1020): Exception "Overflow" set
Failure: tanpi_upward (0xf.ffffffffffffbffffffffffffcp+1020): errno set to 33, expected 0 (unchanged)
Failure: Test: tanpi_upward (0xf.ffffffffffffbffffffffffffcp+1020)
Result:
is: qNaN
should be: 0.00000000000000000000000000000000e+00 0x0.000000000000000000000000000p+0
|
|
The pi defined constants are not the expected value for carg
on non-default rounding modes (similar to atan). Instead use
autogenerated value.
|
|
The pi defined constants are not the expected value for atan2
on non-default rounding modes. Instead use the autogenerated value.
Reviewed-by: DJ Delorie <dj@redhat.com>
|
|
The M_PI_2 (lit_pi_2_d) constant is not the expected value for atanf
on non-default rounding modes. Instead use the autogenerated value.
|
|
C23 adds various <math.h> function families originally defined in TS
18661-4. Add the atan2pi functions (atan2(y,x)/pi).
Tested for x86_64 and x86, and with build-many-glibcs.py.
|
|
C23 adds various <math.h> function families originally defined in TS
18661-4. Add the atanpi functions (atan(x)/pi).
Tested for x86_64 and x86, and with build-many-glibcs.py.
|
|
C23 adds various <math.h> function families originally defined in TS
18661-4. Add the asinpi functions (asin(x)/pi).
Tested for x86_64 and x86, and with build-many-glibcs.py.
|
|
C23 adds various <math.h> function families originally defined in TS
18661-4. Add the acospi functions (acos(x)/pi).
Tested for x86_64 and x86, and with build-many-glibcs.py.
|
|
C23 adds various <math.h> function families originally defined in TS
18661-4. Add the tanpi functions (tan(pi*x)).
Tested for x86_64 and x86, and with build-many-glibcs.py.
|
|
On powerpc math/test-ibm128-sinpi shows:
testing long double (without inline functions)
Failure: sinpi_downward (-0xf.ffffffffffffbffffffffffffcp+1020): Exception "Invalid operation" set
Failure: sinpi_downward (-0xf.ffffffffffffbffffffffffffcp+1020): Exception "Overflow" set
Failure: sinpi_downward (-0xf.ffffffffffffbffffffffffffcp+1020): errno set to 33, expected 0 (unchanged)
Failure: Test: sinpi_downward (-0xf.ffffffffffffbffffffffffffcp+1020)
Result:
is: qNaN
should be: -0.00000000000000000000000000000000e+00 -0x0.000000000000000000000000000p+0
Failure: Test: sinpi_downward (0x3.fffffffffffffffcp+108)
Result:
is: 2.97479253223185882765417834495004e-15 0x1.acb679186c7b49a36c9ec63e110p-49
should be: 0.00000000000000000000000000000000e+00 0x0.000000000000000000000000000p+0
difference: 2.97479253223185882765417834495004e-15 0x1.acb679186c7b49a36c9ec63e110p-49
ulp : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321
max.ulp : 4.0000
Failure: Test: sinpi_downward (0x3.ffffffffffffffffffffffffffp+108)
Result:
is: 2.63250110604328276654475674742669e-15 0x1.7b6225fa8503a5a8c514f5c0208p-49
should be: 0.00000000000000000000000000000000e+00 0x0.000000000000000000000000000p+0
difference: 2.63250110604328276654475674742669e-15 0x1.7b6225fa8503a5a8c514f5c0208p-49
ulp : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321
max.ulp : 4.0000
Failure: Test: sinpi_towardzero (-0x3.fffffffffffffffcp+108)
Result:
is: -1.71856472474338625450766636956702e-14 -0x1.3596cf230d8f69346d93d8c3100p-46
should be: -0.00000000000000000000000000000000e+00 -0x0.000000000000000000000000000p+0
difference: 1.71856472474338625450766636956702e-14 0x1.3596cf230d8f69346d93d8c3100p-46
ulp : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321
max.ulp : 3.0000
Failure: Test: sinpi_towardzero (-0x3.ffffffffffffffffffffffffffp+108)
Result:
is: -9.73792846364428462525599942305655e-15 -0x1.5ed8897ea140e96a31453d6e580p-47
should be: -0.00000000000000000000000000000000e+00 -0x0.000000000000000000000000000p+0
difference: 9.73792846364428462525599942305655e-15 0x1.5ed8897ea140e96a31453d6e580p-47
ulp : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321
max.ulp : 3.0000
Failure: Test: sinpi_towardzero (0x3.fffffffffffffffcp+108)
Result:
is: 1.71856472474338625450766636956702e-14 0x1.3596cf230d8f69346d93d8c3100p-46
should be: 0.00000000000000000000000000000000e+00 0x0.000000000000000000000000000p+0
difference: 1.71856472474338625450766636956702e-14 0x1.3596cf230d8f69346d93d8c3100p-46
ulp : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321
max.ulp : 3.0000
Failure: Test: sinpi_towardzero (0x3.ffffffffffffffffffffffffffp+108)
Result:
is: 9.73792846364428462525599942305655e-15 0x1.5ed8897ea140e96a31453d6e580p-47
should be: 0.00000000000000000000000000000000e+00 0x0.000000000000000000000000000p+0
difference: 9.73792846364428462525599942305655e-15 0x1.5ed8897ea140e96a31453d6e580p-47
ulp : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321
max.ulp : 3.0000
Failure: Test: sinpi_upward (-0x3.fffffffffffffffcp+108)
Result:
is: -1.71856472474338625450766636956709e-14 -0x1.3596cf230d8f69346d93d8c3110p-46
should be: -0.00000000000000000000000000000000e+00 -0x0.000000000000000000000000000p+0
difference: 1.71856472474338625450766636956710e-14 0x1.3596cf230d8f69346d93d8c3110p-46
ulp : inf
max.ulp : 4.0000
Failure: Test: sinpi_upward (-0x3.ffffffffffffffffffffffffffp+108)
Result:
is: -9.73792846364428462525599942305708e-15 -0x1.5ed8897ea140e96a31453d6e598p-47
should be: -0.00000000000000000000000000000000e+00 -0x0.000000000000000000000000000p+0
difference: 9.73792846364428462525599942305709e-15 0x1.5ed8897ea140e96a31453d6e598p-47
ulp : inf
max.ulp : 4.0000
Failure: sinpi_upward (0xf.ffffffffffffbffffffffffffcp+1020): Exception "Invalid operation" set
Failure: sinpi_upward (0xf.ffffffffffffbffffffffffffcp+1020): Exception "Overflow" set
Failure: sinpi_upward (0xf.ffffffffffffbffffffffffffcp+1020): errno set to 33, expected 0 (unchanged)
Failure: Test: sinpi_upward (0xf.ffffffffffffbffffffffffffcp+1020)
Result:
is: qNaN
should be: 0.00000000000000000000000000000000e+00 0x0.000000000000000000000000000p+0
|
|
On powerpc math/test-ibm128-cospi shows:
testing long double (without inline functions)
Failure: cospi_downward (-0xf.ffffffffffffbffffffffffffcp+1020): Exception "Invalid operation" set
Failure: cospi_downward (-0xf.ffffffffffffbffffffffffffcp+1020): Exception "Overflow" set
Failure: cospi_downward (-0xf.ffffffffffffbffffffffffffcp+1020): errno set to 33, expected 0 (unchanged)
Failure: Test: cospi_downward (-0xf.ffffffffffffbffffffffffffcp+1020)
Result:
is: qNaN
should be: 1.00000000000000000000000000000000e+00 0x1.000000000000000000000000000p+0
Failure: Test: cospi_downward (0x3.fffffffffffffffcp+108)
Result:
is: 9.99999999999999999999999999995574e-01 0x1.ffffffffffffffffffffffff4c8p-1
should be: 1.00000000000000000000000000000000e+00 0x1.000000000000000000000000000p+0
difference: 4.42501664022411309598141492088312e-30 0x1.670000000000000000000000000p-98
ulp : 179.5000
max.ulp : 4.0000
Failure: Test: cospi_downward (0x3.ffffffffffffffffffffffffffp+108)
Result:
is: 9.99999999999999999999999999996524e-01 0x1.ffffffffffffffffffffffff730p-1
should be: 1.00000000000000000000000000000000e+00 0x1.000000000000000000000000000p+0
difference: 3.47591836363008326759542899077727e-30 0x1.1a0000000000000000000000000p-98
ulp : 141.0000
max.ulp : 4.0000
Failure: Test: cospi_towardzero (-0x3.fffffffffffffffcp+108)
Result:
is: 9.99999999999999999999999999852310e-01 0x1.ffffffffffffffffffffffe8990p-1
should be: 1.00000000000000000000000000000000e+00 0x1.000000000000000000000000000p+0
difference: 1.47689552599346303944427057331536e-28 0x1.767000000000000000000000000p-93
ulp : 5991.0000
max.ulp : 4.0000
Failure: Test: cospi_towardzero (-0x3.ffffffffffffffffffffffffffp+108)
Result:
is: 9.99999999999999999999999999952569e-01 0x1.fffffffffffffffffffffff87c0p-1
should be: 1.00000000000000000000000000000000e+00 0x1.000000000000000000000000000p+0
difference: 4.74302619264133348003801799876275e-29 0x1.e10000000000000000000000000p-95
ulp : 1924.0000
max.ulp : 4.0000
Failure: Test: cospi_towardzero (0x3.fffffffffffffffcp+108)
Result:
is: 9.99999999999999999999999999852310e-01 0x1.ffffffffffffffffffffffe8990p-1
should be: 1.00000000000000000000000000000000e+00 0x1.000000000000000000000000000p+0
difference: 1.47689552599346303944427057331536e-28 0x1.767000000000000000000000000p-93
ulp : 5991.0000
max.ulp : 4.0000
Failure: Test: cospi_towardzero (0x3.ffffffffffffffffffffffffffp+108)
Result:
is: 9.99999999999999999999999999952569e-01 0x1.fffffffffffffffffffffff87c0p-1
should be: 1.00000000000000000000000000000000e+00 0x1.000000000000000000000000000p+0
difference: 4.74302619264133348003801799876275e-29 0x1.e10000000000000000000000000p-95
ulp : 1924.0000
max.ulp : 4.0000
Failure: Test: cospi_upward (-0x3.fffffffffffffffcp+108)
Result:
is: 9.99999999999999999999999999852323e-01 0x1.ffffffffffffffffffffffe899bp-1
should be: 1.00000000000000000000000000000000e+00 0x1.000000000000000000000000000p+0
difference: 1.47673235656615530277812119019587e-28 0x1.766568e20369c00000000000000p-93
ulp : 5990.3382
max.ulp : 4.0000
Failure: Test: cospi_upward (-0x3.ffffffffffffffffffffffffffp+108)
Result:
is: 9.99999999999999999999999999952583e-01 0x1.fffffffffffffffffffffff87cbp-1
should be: 1.00000000000000000000000000000000e+00 0x1.000000000000000000000000000p+0
difference: 4.74136253815267677203679334037676e-29 0x1.e0d4cf1e9076600000000000000p-95
ulp : 1923.3252
max.ulp : 4.0000
Failure: cospi_upward (0xf.ffffffffffffbffffffffffffcp+1020): Exception "Invalid operation" set
Failure: cospi_upward (0xf.ffffffffffffbffffffffffffcp+1020): Exception "Overflow" set
Failure: cospi_upward (0xf.ffffffffffffbffffffffffffcp+1020): errno set to 33, expected 0 (unchanged)
Failure: Test: cospi_upward (0xf.ffffffffffffbffffffffffffcp+1020)
Result:
is: qNaN
should be: 1.00000000000000000000000000000000e+00 0x1.000000000000000000000000000p+0
|
|
C23 adds various <math.h> function families originally defined in TS
18661-4. Add the sinpi functions (sin(pi*x)).
Tested for x86_64 and x86, and with build-many-glibcs.py.
|
|
C23 adds various <math.h> function families originally defined in TS
18661-4. Add the cospi functions (cos(pi*x)).
Tested for x86_64 and x86, and with build-many-glibcs.py.
|
|
These functions are exp10m1, exp2m1, log10p1, log2p1.
Also regenerated ulps on x86_64.
For each format, there are 4 values, one for each rounding mode.
(For the intel96 format, there are 8 values, 4 for Intel hardware,
and 4 for AMD hardware. However, regen-ulps was only run on Intel.
It should be run in a separate patch on a AMD x86_64.)
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
|
Changes in v2:
- added larger error for long double on AMD reported by Adhemerval
(https://sourceware.org/pipermail/libc-alpha/2024-June/157755.html)
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
|
C23 adds various <math.h> function families originally defined in TS
18661-4. Add the exp2m1 and exp10m1 functions (exp2(x)-1 and
exp10(x)-1, like expm1).
As with other such functions, these use type-generic templates that
could be replaced with faster and more accurate type-specific
implementations in future. Test inputs are copied from those for
expm1, plus some additions close to the overflow threshold (copied
from exp2 and exp10) and also some near the underflow threshold.
exp2m1 has the unusual property of having an input (M_MAX_EXP) where
whether the function overflows (under IEEE semantics) depends on the
rounding mode. Although these could reasonably be XFAILed in the
testsuite (as we do in some cases for arguments very close to a
function's overflow threshold when an error of a few ulps in the
implementation can result in the implementation not agreeing with an
ideal one on whether overflow takes place - the testsuite isn't smart
enough to handle this automatically), since these functions aren't
required to be correctly rounding, I made the implementation check for
and handle this case specially.
The Makefile ordering expected by lint-makefiles for the new functions
is a bit peculiar, but I implemented it in this patch so that the test
passes; I don't know why log2 also needed moving in one Makefile
variable setting when it didn't in my previous patches, but the
failure showed a different place was expected for that function as
well.
The powerpc64le IFUNC setup seems not to be as self-contained as one
might hope; it shouldn't be necessary to add IFUNCs for new functions
such as these simply to get them building, but without setting up
IFUNCs for the new functions, there were undefined references to
__GI___expm1f128 (that IFUNC machinery results in no such function
being defined, but doesn't stop include/math.h from doing the
redirection resulting in the exp2m1f128 and exp10m1f128
implementations expecting to call it).
Tested for x86_64 and x86, and with build-many-glibcs.py.
|
|
C23 adds various <math.h> function families originally defined in TS
18661-4. Add the log10p1 functions (log10(1+x): like log1p, but for
base-10 logarithms).
This is directly analogous to the log2p1 implementation (except that
whereas log2p1 has a smaller underflow range than log1p, log10p1 has a
larger underflow range). The test inputs are copied from those for
log1p and log2p1, plus a few more inputs in that wider underflow
range.
Tested for x86_64 and x86, and with build-many-glibcs.py.
|
|
C23 adds various <math.h> function families originally defined in TS
18661-4. Add the log2p1 functions (log2(1+x): like log1p, but for
base-2 logarithms).
This illustrates the intended structure of implementations of all
these function families: define them initially with a type-generic
template implementation. If someone wishes to add type-specific
implementations, it is likely such implementations can be both faster
and more accurate than the type-generic one and can then override it
for types for which they are implemented (adding benchmarks would be
desirable in such cases to demonstrate that a new implementation is
indeed faster).
The test inputs are copied from those for log1p. Note that these
changes make gen-auto-libm-tests depend on MPFR 4.2 (or later).
The bulk of the changes are fairly generic for any such new function.
(sysdeps/powerpc/nofpu/Makefile only needs changing for those
type-generic templates that use fabs.)
Tested for x86_64 and x86, and with build-many-glibcs.py.
|
|
Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
|
|
|