From a1ffb40e32741f992c743e7b16c061fefa3747ac Mon Sep 17 00:00:00 2001 From: OndÅ™ej Bílka Date: Mon, 10 Feb 2014 14:45:42 +0100 Subject: Use glibc_likely instead __builtin_expect. --- sysdeps/ieee754/dbl-64/s_log1p.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sysdeps/ieee754/dbl-64/s_log1p.c') diff --git a/sysdeps/ieee754/dbl-64/s_log1p.c b/sysdeps/ieee754/dbl-64/s_log1p.c index ea1dc6ca76..fd4dce5f23 100644 --- a/sysdeps/ieee754/dbl-64/s_log1p.c +++ b/sysdeps/ieee754/dbl-64/s_log1p.c @@ -107,14 +107,14 @@ __log1p (double x) k = 1; if (hx < 0x3FDA827A) /* x < 0.41422 */ { - if (__builtin_expect (ax >= 0x3ff00000, 0)) /* x <= -1.0 */ + if (__glibc_unlikely (ax >= 0x3ff00000)) /* x <= -1.0 */ { if (x == -1.0) return -two54 / (x - x); /* log1p(-1)=+inf */ else return (x - x) / (x - x); /* log1p(x<-1)=NaN */ } - if (__builtin_expect (ax < 0x3e200000, 0)) /* |x| < 2**-29 */ + if (__glibc_unlikely (ax < 0x3e200000)) /* |x| < 2**-29 */ { math_force_eval (two54 + x); /* raise inexact */ if (ax < 0x3c900000) /* |x| < 2**-54 */ @@ -127,7 +127,7 @@ __log1p (double x) k = 0; f = x; hu = 1; } /* -0.2929= 0x7ff00000, 0)) + else if (__glibc_unlikely (hx >= 0x7ff00000)) return x + x; if (k != 0) { -- cgit v1.2.3 From 2ca180e97a16f3ee3ec9e7e5a5fb7eda3d863a02 Mon Sep 17 00:00:00 2001 From: Stefan Liebler Date: Tue, 29 Apr 2014 15:43:36 +0200 Subject: [BZ #16823] Fix log1pl returning wrong infinity sign --- ChangeLog | 8 ++++++++ sysdeps/ieee754/dbl-64/s_log1p.c | 2 +- sysdeps/ieee754/flt-32/s_log1pf.c | 2 +- sysdeps/ieee754/ldbl-128/s_log1pl.c | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) (limited to 'sysdeps/ieee754/dbl-64/s_log1p.c') diff --git a/ChangeLog b/ChangeLog index 4007295165..803d11414a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2014-04-29 Stefan Liebler + + [BZ #16823] + * sysdeps/ieee754/ldbl-128/s_log1pl.c (__log1pl): + Always divide by positive zero when computing -Inf result. + * sysdeps/ieee754/dbl-64/s_log1p.c (__log1p): Likewise. + * sysdeps/ieee754/flt-32/s_log1pf.c (__log1pf): Likewise. + 2014-04-28 Adhemerval Zanella * sysdeps/powerpc/fpu/fclrexcpt.c (__feclearexcept): Do not update diff --git a/sysdeps/ieee754/dbl-64/s_log1p.c b/sysdeps/ieee754/dbl-64/s_log1p.c index fd4dce5f23..c922148937 100644 --- a/sysdeps/ieee754/dbl-64/s_log1p.c +++ b/sysdeps/ieee754/dbl-64/s_log1p.c @@ -110,7 +110,7 @@ __log1p (double x) if (__glibc_unlikely (ax >= 0x3ff00000)) /* x <= -1.0 */ { if (x == -1.0) - return -two54 / (x - x); /* log1p(-1)=+inf */ + return -two54 / zero; /* log1p(-1)=-inf */ else return (x - x) / (x - x); /* log1p(x<-1)=NaN */ } diff --git a/sysdeps/ieee754/flt-32/s_log1pf.c b/sysdeps/ieee754/flt-32/s_log1pf.c index 0307277106..5f00febc04 100644 --- a/sysdeps/ieee754/flt-32/s_log1pf.c +++ b/sysdeps/ieee754/flt-32/s_log1pf.c @@ -42,7 +42,7 @@ __log1pf(float x) k = 1; if (hx < 0x3ed413d7) { /* x < 0.41422 */ if(ax>=0x3f800000) { /* x <= -1.0 */ - if(x==(float)-1.0) return -two25/(x-x); /* log1p(-1)=+inf */ + if(x==(float)-1.0) return -two25/zero; /* log1p(-1)=-inf */ else return (x-x)/(x-x); /* log1p(x<-1)=NaN */ } if(ax<0x31000000) { /* |x| < 2**-29 */ diff --git a/sysdeps/ieee754/ldbl-128/s_log1pl.c b/sysdeps/ieee754/ldbl-128/s_log1pl.c index d991e8a720..d8d89f0a8c 100644 --- a/sysdeps/ieee754/ldbl-128/s_log1pl.c +++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c @@ -150,7 +150,7 @@ __log1pl (long double xm1) if (x <= 0.0L) { if (x == 0.0L) - return (-1.0L / (x - x)); + return (-1.0L / zero); /* log1p(-1) = -inf */ else return (zero / (x - x)); } -- cgit v1.2.3 From de8aadd52c97f9a04d5e8709b16dc5baf9292a09 Mon Sep 17 00:00:00 2001 From: Stefan Liebler Date: Mon, 13 Apr 2015 21:16:56 +0200 Subject: Set errno for log1p on pole/domain error. According to bug 6792, errno is not set to ERANGE/EDOM by calling log1p/log1pf/log1pl with x = -1 or x < -1. This patch adds a wrapper which sets errno in those cases and returns the value of the existing __log1p function. The log1p is now an alias to the wrapper function instead of __log1p. The files in sysdeps are reflecting these changes. The ia64 implementation sets errno by itself, thus the wrapper-file is empty. The libm-test is adjusted for log1p-tests to check errno. [BZ #6792] * math/w_log1p.c: New file. * math/w_log1pf.c: Likewise. * math/w_log1pl.c: Likewise. * math/Makefile (libm-calls): Add w_log1p. * math/s_log1pl.c (log1pl): Remove weak_alias. * sysdeps/i386/fpu/s_log1p.S (log1p): Likewise. * sysdeps/i386/fpu/s_log1pf.S (log1pf): Likewise. * sysdeps/i386/fpu/s_log1pl.S (log1pl): Likewise. * sysdeps/x86_64/fpu/s_log1pl.S (log1pl): Likewise. * sysdeps/ieee754/dbl-64/s_log1p.c (log1p): Likewise. [NO_LONG_DOUBLE] (log1pl): Likewise. * sysdeps/ieee754/flt-32/s_log1pf.c (log1pf): Likewise. * sysdeps/ieee754/ldbl-128/s_log1pl.c (log1pl): Likewise. * sysdeps/ieee754/ldbl-64-128/s_log1pl.c (log1p): Remove long_double_symbol. * sysdeps/ieee754/ldbl-128ibm/s_log1pl.c (log1pl): Likewise. * sysdeps/ieee754/ldbl-64-128/w_log1pl.c: New file. * sysdeps/ieee754/ldbl-128ibm/w_log1pl.c: Likewise. * sysdeps/m68k/m680x0/fpu/s_log1p.c: Define empty weak_alias to remove weak_alias for corresponding log1p function. * sysdeps/m68k/m680x0/fpu/s_log1pf.c: Likewise. * sysdeps/m68k/m680x0/fpu/s_log1pl.c: Likewise. * sysdeps/ia64/fpu/w_log1p.c: New file. * sysdeps/ia64/fpu/w_log1pf.c: Likewise. * sysdeps/ia64/fpu/w_log1pl.c: Likewise. * math/libm-test.inc (log1p_test_data): Add errno expectations. --- ChangeLog | 30 +++++++++++++++++++++++++ NEWS | 2 +- math/Makefile | 2 +- math/libm-test.inc | 8 +++---- math/s_log1pl.c | 1 - math/w_log1p.c | 41 ++++++++++++++++++++++++++++++++++ math/w_log1pf.c | 36 +++++++++++++++++++++++++++++ math/w_log1pl.c | 36 +++++++++++++++++++++++++++++ sysdeps/i386/fpu/s_log1p.S | 1 - sysdeps/i386/fpu/s_log1pf.S | 1 - sysdeps/i386/fpu/s_log1pl.S | 1 - sysdeps/ia64/fpu/w_log1p.c | 20 +++++++++++++++++ sysdeps/ia64/fpu/w_log1pf.c | 20 +++++++++++++++++ sysdeps/ia64/fpu/w_log1pl.c | 20 +++++++++++++++++ sysdeps/ieee754/dbl-64/s_log1p.c | 5 ----- sysdeps/ieee754/flt-32/s_log1pf.c | 1 - sysdeps/ieee754/ldbl-128/s_log1pl.c | 2 -- sysdeps/ieee754/ldbl-128ibm/s_log1pl.c | 2 -- sysdeps/ieee754/ldbl-128ibm/w_log1pl.c | 23 +++++++++++++++++++ sysdeps/ieee754/ldbl-64-128/s_log1pl.c | 3 --- sysdeps/ieee754/ldbl-64-128/w_log1pl.c | 23 +++++++++++++++++++ sysdeps/m68k/m680x0/fpu/s_log1p.c | 2 ++ sysdeps/m68k/m680x0/fpu/s_log1pf.c | 2 ++ sysdeps/m68k/m680x0/fpu/s_log1pl.c | 2 ++ sysdeps/x86_64/fpu/s_log1pl.S | 1 - 25 files changed, 261 insertions(+), 24 deletions(-) create mode 100644 math/w_log1p.c create mode 100644 math/w_log1pf.c create mode 100644 math/w_log1pl.c create mode 100644 sysdeps/ia64/fpu/w_log1p.c create mode 100644 sysdeps/ia64/fpu/w_log1pf.c create mode 100644 sysdeps/ia64/fpu/w_log1pl.c create mode 100644 sysdeps/ieee754/ldbl-128ibm/w_log1pl.c create mode 100644 sysdeps/ieee754/ldbl-64-128/w_log1pl.c (limited to 'sysdeps/ieee754/dbl-64/s_log1p.c') diff --git a/ChangeLog b/ChangeLog index def3b516bf..60c1bd6835 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +2015-04-13 Stefan Liebler + + [BZ #6792] + * math/w_log1p.c: New file. + * math/w_log1pf.c: Likewise. + * math/w_log1pl.c: Likewise. + * math/Makefile (libm-calls): Add w_log1p. + * math/s_log1pl.c (log1pl): Remove weak_alias. + * sysdeps/i386/fpu/s_log1p.S (log1p): Likewise. + * sysdeps/i386/fpu/s_log1pf.S (log1pf): Likewise. + * sysdeps/i386/fpu/s_log1pl.S (log1pl): Likewise. + * sysdeps/x86_64/fpu/s_log1pl.S (log1pl): Likewise. + * sysdeps/ieee754/dbl-64/s_log1p.c (log1p): Likewise. + [NO_LONG_DOUBLE] (log1pl): Likewise. + * sysdeps/ieee754/flt-32/s_log1pf.c (log1pf): Likewise. + * sysdeps/ieee754/ldbl-128/s_log1pl.c (log1pl): Likewise. + * sysdeps/ieee754/ldbl-64-128/s_log1pl.c + (log1p): Remove long_double_symbol. + * sysdeps/ieee754/ldbl-128ibm/s_log1pl.c (log1pl): Likewise. + * sysdeps/ieee754/ldbl-64-128/w_log1pl.c: New file. + * sysdeps/ieee754/ldbl-128ibm/w_log1pl.c: Likewise. + * sysdeps/m68k/m680x0/fpu/s_log1p.c: Define empty weak_alias to + remove weak_alias for corresponding log1p function. + * sysdeps/m68k/m680x0/fpu/s_log1pf.c: Likewise. + * sysdeps/m68k/m680x0/fpu/s_log1pl.c: Likewise. + * sysdeps/ia64/fpu/w_log1p.c: New file. + * sysdeps/ia64/fpu/w_log1pf.c: Likewise. + * sysdeps/ia64/fpu/w_log1pl.c: Likewise. + * math/libm-test.inc (log1p_test_data): Add errno expectations. + 2015-04-10 Joseph Myers [BZ #18247] diff --git a/NEWS b/NEWS index 22ce5e30c6..fb614bed25 100644 --- a/NEWS +++ b/NEWS @@ -9,7 +9,7 @@ Version 2.22 * The following bugs are resolved with this release: - 4719, 13064, 14094, 14841, 14906, 15319, 15467, 15790, 15969, 16351, + 4719, 6792, 13064, 14094, 14841, 14906, 15319, 15467, 15790, 15969, 16351, 16512, 16560, 16783, 16850, 17090, 17195, 17269, 17523, 17542, 17569, 17588, 17596, 17620, 17621, 17628, 17631, 17711, 17776, 17779, 17792, 17836, 17912, 17916, 17930, 17932, 17944, 17949, 17964, 17965, 17967, diff --git a/math/Makefile b/math/Makefile index 3904e41a3c..1537b5a6c4 100644 --- a/math/Makefile +++ b/math/Makefile @@ -47,7 +47,7 @@ libm-calls = e_acos e_acosh e_asin e_atan2 e_atanh e_cosh e_exp e_fmod \ e_ilogb \ k_cos k_rem_pio2 k_sin k_tan s_asinh s_atan s_cbrt \ s_ceil s_cos s_erf s_expm1 s_fabs \ - s_floor s_log1p s_logb \ + s_floor s_log1p w_log1p s_logb \ s_nextafter s_nexttoward s_rint s_scalbln w_scalbln \ s_significand s_sin s_tan s_tanh w_acos w_acosh w_asin \ w_atan2 w_atanh w_cosh w_drem w_exp w_exp2 w_exp10 w_fmod \ diff --git a/math/libm-test.inc b/math/libm-test.inc index 7acd29bc13..5d7f5a25c8 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -7798,10 +7798,10 @@ log10_test (void) static const struct test_f_f_data log1p_test_data[] = { - TEST_f_f (log1p, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION), - TEST_f_f (log1p, -2, qnan_value, INVALID_EXCEPTION), - TEST_f_f (log1p, -max_value, qnan_value, INVALID_EXCEPTION), - TEST_f_f (log1p, minus_infty, qnan_value, INVALID_EXCEPTION), + TEST_f_f (log1p, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE), + TEST_f_f (log1p, -2, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), + TEST_f_f (log1p, -max_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), + TEST_f_f (log1p, minus_infty, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), TEST_f_f (log1p, plus_infty, plus_infty), TEST_f_f (log1p, qnan_value, qnan_value, NO_INEXACT_EXCEPTION), diff --git a/math/s_log1pl.c b/math/s_log1pl.c index 9e51ce2d43..a216fb3cef 100644 --- a/math/s_log1pl.c +++ b/math/s_log1pl.c @@ -9,6 +9,5 @@ __log1pl (long double x) __set_errno (ENOSYS); return 0.0; } -weak_alias (__log1pl, log1pl) stub_warning (log1pl) diff --git a/math/w_log1p.c b/math/w_log1p.c new file mode 100644 index 0000000000..28b621b301 --- /dev/null +++ b/math/w_log1p.c @@ -0,0 +1,41 @@ +/* Wrapper for __log1p that handles setting errno. + Copyright (C) 2015 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include + +double +__w_log1p (double x) +{ + if (__glibc_unlikely (islessequal (x, -1.0))) + { + if (x == -1.0) + __set_errno (ERANGE); + else + __set_errno (EDOM); + } + + return __log1p (x); +} +weak_alias (__w_log1p, log1p) + +#ifdef NO_LONG_DOUBLE +strong_alias (__w_log1p, __log1pl) +weak_alias (__w_log1p, log1pl) +#endif diff --git a/math/w_log1pf.c b/math/w_log1pf.c new file mode 100644 index 0000000000..80510b913a --- /dev/null +++ b/math/w_log1pf.c @@ -0,0 +1,36 @@ +/* Wrapper for __log1pf that handles setting errno. + Copyright (C) 2015 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include + +float +__w_log1pf (float x) +{ + if (__glibc_unlikely (islessequal (x, -1.0f))) + { + if (x == -1.0f) + __set_errno (ERANGE); + else + __set_errno (EDOM); + } + + return __log1pf (x); +} +weak_alias (__w_log1pf, log1pf) diff --git a/math/w_log1pl.c b/math/w_log1pl.c new file mode 100644 index 0000000000..056fe07bcd --- /dev/null +++ b/math/w_log1pl.c @@ -0,0 +1,36 @@ +/* Wrapper for __log1pl that handles setting errno. + Copyright (C) 2015 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include + +long double +__w_log1pl (long double x) +{ + if (__glibc_unlikely (islessequal (x, -1.0L))) + { + if (x == -1.0L) + __set_errno (ERANGE); + else + __set_errno (EDOM); + } + + return __log1pl (x); +} +weak_alias (__w_log1pl, log1pl) diff --git a/sysdeps/i386/fpu/s_log1p.S b/sysdeps/i386/fpu/s_log1p.S index 797a2abf62..8624249dba 100644 --- a/sysdeps/i386/fpu/s_log1p.S +++ b/sysdeps/i386/fpu/s_log1p.S @@ -63,4 +63,3 @@ ENTRY(__log1p) ret END (__log1p) -weak_alias (__log1p, log1p) diff --git a/sysdeps/i386/fpu/s_log1pf.S b/sysdeps/i386/fpu/s_log1pf.S index 1e7f2e1c5f..b071e7372d 100644 --- a/sysdeps/i386/fpu/s_log1pf.S +++ b/sysdeps/i386/fpu/s_log1pf.S @@ -63,4 +63,3 @@ ENTRY(__log1pf) ret END (__log1pf) -weak_alias (__log1pf, log1pf) diff --git a/sysdeps/i386/fpu/s_log1pl.S b/sysdeps/i386/fpu/s_log1pl.S index d2d5d3bc7c..8f87cf61c6 100644 --- a/sysdeps/i386/fpu/s_log1pl.S +++ b/sysdeps/i386/fpu/s_log1pl.S @@ -75,4 +75,3 @@ ENTRY(__log1pl) ret END (__log1pl) -weak_alias (__log1pl, log1pl) diff --git a/sysdeps/ia64/fpu/w_log1p.c b/sysdeps/ia64/fpu/w_log1p.c new file mode 100644 index 0000000000..f28fb24ab8 --- /dev/null +++ b/sysdeps/ia64/fpu/w_log1p.c @@ -0,0 +1,20 @@ +/* Wrapper for __log1p that handles setting errno. + Copyright (C) 2015 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* Nothing to do. + errno is set in sysdeps/ia64/fpu/s_log1p.S. */ diff --git a/sysdeps/ia64/fpu/w_log1pf.c b/sysdeps/ia64/fpu/w_log1pf.c new file mode 100644 index 0000000000..356cc6b282 --- /dev/null +++ b/sysdeps/ia64/fpu/w_log1pf.c @@ -0,0 +1,20 @@ +/* Wrapper for __log1pf that handles setting errno. + Copyright (C) 2015 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* Nothing to do. + errno is set in sysdeps/ia64/fpu/s_log1pf.S. */ diff --git a/sysdeps/ia64/fpu/w_log1pl.c b/sysdeps/ia64/fpu/w_log1pl.c new file mode 100644 index 0000000000..f66c223d61 --- /dev/null +++ b/sysdeps/ia64/fpu/w_log1pl.c @@ -0,0 +1,20 @@ +/* Wrapper for __log1pl that handles setting errno. + Copyright (C) 2015 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* Nothing to do. + errno is set in sysdeps/ia64/fpu/s_log1pl.S. */ diff --git a/sysdeps/ieee754/dbl-64/s_log1p.c b/sysdeps/ieee754/dbl-64/s_log1p.c index c922148937..86bbfbacaf 100644 --- a/sysdeps/ieee754/dbl-64/s_log1p.c +++ b/sysdeps/ieee754/dbl-64/s_log1p.c @@ -189,8 +189,3 @@ __log1p (double x) else return k * ln2_hi - ((hfsq - (s * (hfsq + R) + (k * ln2_lo + c))) - f); } -weak_alias (__log1p, log1p) -#ifdef NO_LONG_DOUBLE -strong_alias (__log1p, __log1pl) -weak_alias (__log1p, log1pl) -#endif diff --git a/sysdeps/ieee754/flt-32/s_log1pf.c b/sysdeps/ieee754/flt-32/s_log1pf.c index 5f00febc04..94c33fca16 100644 --- a/sysdeps/ieee754/flt-32/s_log1pf.c +++ b/sysdeps/ieee754/flt-32/s_log1pf.c @@ -96,4 +96,3 @@ __log1pf(float x) if(k==0) return f-(hfsq-s*(hfsq+R)); else return k*ln2_hi-((hfsq-(s*(hfsq+R)+(k*ln2_lo+c)))-f); } -weak_alias (__log1pf, log1pf) diff --git a/sysdeps/ieee754/ldbl-128/s_log1pl.c b/sysdeps/ieee754/ldbl-128/s_log1pl.c index 4a30af62fa..b70a55b758 100644 --- a/sysdeps/ieee754/ldbl-128/s_log1pl.c +++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c @@ -253,5 +253,3 @@ __log1pl (long double xm1) z = z + e * C1; return (z); } - -weak_alias (__log1pl, log1pl) diff --git a/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c b/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c index e4bb6e8d9b..a0e24d7f22 100644 --- a/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c +++ b/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c @@ -249,5 +249,3 @@ __log1pl (long double xm1) z = z + e * C1; return (z); } - -long_double_symbol (libm, __log1pl, log1pl); diff --git a/sysdeps/ieee754/ldbl-128ibm/w_log1pl.c b/sysdeps/ieee754/ldbl-128ibm/w_log1pl.c new file mode 100644 index 0000000000..279a62a0f4 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm/w_log1pl.c @@ -0,0 +1,23 @@ +/* Wrapper for __log1pl that handles setting errno. + Copyright (C) 2015 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#undef weak_alias +#define weak_alias(n,a) +#include +long_double_symbol (libm, __w_log1pl, log1pl); diff --git a/sysdeps/ieee754/ldbl-64-128/s_log1pl.c b/sysdeps/ieee754/ldbl-64-128/s_log1pl.c index eebd63638a..11d56bfe9f 100644 --- a/sysdeps/ieee754/ldbl-64-128/s_log1pl.c +++ b/sysdeps/ieee754/ldbl-64-128/s_log1pl.c @@ -1,5 +1,2 @@ #include -#undef weak_alias -#define weak_alias(n,a) #include -long_double_symbol (libm, __log1pl, log1pl); diff --git a/sysdeps/ieee754/ldbl-64-128/w_log1pl.c b/sysdeps/ieee754/ldbl-64-128/w_log1pl.c new file mode 100644 index 0000000000..279a62a0f4 --- /dev/null +++ b/sysdeps/ieee754/ldbl-64-128/w_log1pl.c @@ -0,0 +1,23 @@ +/* Wrapper for __log1pl that handles setting errno. + Copyright (C) 2015 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#undef weak_alias +#define weak_alias(n,a) +#include +long_double_symbol (libm, __w_log1pl, log1pl); diff --git a/sysdeps/m68k/m680x0/fpu/s_log1p.c b/sysdeps/m68k/m680x0/fpu/s_log1p.c index 1840ced137..082618df18 100644 --- a/sysdeps/m68k/m680x0/fpu/s_log1p.c +++ b/sysdeps/m68k/m680x0/fpu/s_log1p.c @@ -1,2 +1,4 @@ #define FUNC log1p +#undef weak_alias +#define weak_alias(a,b) #include diff --git a/sysdeps/m68k/m680x0/fpu/s_log1pf.c b/sysdeps/m68k/m680x0/fpu/s_log1pf.c index cb7235a071..480c39519f 100644 --- a/sysdeps/m68k/m680x0/fpu/s_log1pf.c +++ b/sysdeps/m68k/m680x0/fpu/s_log1pf.c @@ -1,2 +1,4 @@ #define FUNC log1pf +#undef weak_alias +#define weak_alias(a,b) #include diff --git a/sysdeps/m68k/m680x0/fpu/s_log1pl.c b/sysdeps/m68k/m680x0/fpu/s_log1pl.c index 8dbef89095..a4f34a4f86 100644 --- a/sysdeps/m68k/m680x0/fpu/s_log1pl.c +++ b/sysdeps/m68k/m680x0/fpu/s_log1pl.c @@ -1,2 +1,4 @@ #define FUNC log1pl +#undef weak_alias +#define weak_alias(a,b) #include diff --git a/sysdeps/x86_64/fpu/s_log1pl.S b/sysdeps/x86_64/fpu/s_log1pl.S index af3024ad55..e83f64d3c0 100644 --- a/sysdeps/x86_64/fpu/s_log1pl.S +++ b/sysdeps/x86_64/fpu/s_log1pl.S @@ -71,4 +71,3 @@ ENTRY(__log1pl) ret END (__log1pl) -weak_alias (__log1pl, log1pl) -- cgit v1.2.3 From 0b7a5f920163d03806d7c5d9d1c83b16942c9496 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 14 May 2015 23:38:07 +0000 Subject: Fix log1p missing underflows (bug 16339). Similar to various other bugs in this area, some log1p implementations do not raise the underflow exception for subnormal arguments, when the result is tiny and inexact. This patch forces the exception in a similar way to previous fixes. (The ldbl-128ibm implementation doesn't currently need any change as it already generates this exception, albeit through code that would generate spurious exceptions in other cases; special code for this issue will only be needed there when fixing the spurious exceptions.) Tested for x86_64, x86, powerpc and mips64. [BZ #16339] * sysdeps/i386/fpu/s_log1p.S (dbl_min): New object. (__log1p): Force underflow exception for results with small absolute value. * sysdeps/i386/fpu/s_log1pf.S (flt_min): New object. (__log1pf): Force underflow exception for results with small absolute value. * sysdeps/ieee754/dbl-64/s_log1p.c: Include . (__log1p): Force underflow exception for results with small absolute value. * sysdeps/ieee754/flt-32/s_log1pf.c: Include . (__log1pf): Force underflow exception for results with small absolute value. * sysdeps/ieee754/ldbl-128/s_log1pl.c: Include . (__log1pl): Force underflow exception for results with small absolute value. * math/auto-libm-test-in: Do not allow missing underflow exceptions from log1p. * math/auto-libm-test-out: Regenerated. --- ChangeLog | 22 ++++ NEWS | 2 +- math/auto-libm-test-in | 9 +- math/auto-libm-test-out | 200 ++++++++++++++++++------------------ sysdeps/i386/fpu/s_log1p.S | 27 ++++- sysdeps/i386/fpu/s_log1pf.S | 27 ++++- sysdeps/ieee754/dbl-64/s_log1p.c | 10 +- sysdeps/ieee754/flt-32/s_log1pf.c | 8 ++ sysdeps/ieee754/ldbl-128/s_log1pl.c | 6 ++ 9 files changed, 202 insertions(+), 109 deletions(-) (limited to 'sysdeps/ieee754/dbl-64/s_log1p.c') diff --git a/ChangeLog b/ChangeLog index 3f3a5b14e7..f6bf877b16 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2015-05-14 Joseph Myers + + [BZ #16339] + * sysdeps/i386/fpu/s_log1p.S (dbl_min): New object. + (__log1p): Force underflow exception for results with small + absolute value. + * sysdeps/i386/fpu/s_log1pf.S (flt_min): New object. + (__log1pf): Force underflow exception for results with small + absolute value. + * sysdeps/ieee754/dbl-64/s_log1p.c: Include . + (__log1p): Force underflow exception for results with small + absolute value. + * sysdeps/ieee754/flt-32/s_log1pf.c: Include . + (__log1pf): Force underflow exception for results with small + absolute value. + * sysdeps/ieee754/ldbl-128/s_log1pl.c: Include . + (__log1pl): Force underflow exception for results with small + absolute value. + * math/auto-libm-test-in: Do not allow missing underflow + exceptions from log1p. + * math/auto-libm-test-out: Regenerated. + 2015-05-14 Jakub Bogusz Adhemerval Zanella diff --git a/NEWS b/NEWS index 91027bd83b..a9b0138b3e 100644 --- a/NEWS +++ b/NEWS @@ -9,7 +9,7 @@ Version 2.22 * The following bugs are resolved with this release: - 4719, 6792, 13064, 14094, 14841, 14906, 15319, 15467, 15790, 15969, + 4719, 6792, 13064, 14094, 14841, 14906, 15319, 15467, 15790, 15969, 16339, 16351, 16512, 16560, 16783, 16850, 17090, 17195, 17269, 17523, 17542, 17569, 17588, 17596, 17620, 17621, 17628, 17631, 17692, 17711, 17715, 17776, 17779, 17792, 17836, 17912, 17916, 17930, 17932, 17944, 17949, diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in index 883397c40a..7e5c7bb254 100644 --- a/math/auto-libm-test-in +++ b/math/auto-libm-test-in @@ -1850,11 +1850,10 @@ log1p -0 log1p e-1 log1p -0.25 log1p -0.875 -# Bug 16339: underflow exception may be missing. -log1p min missing-underflow -log1p min_subnorm missing-underflow -log1p -min missing-underflow -log1p -min_subnorm missing-underflow +log1p min +log1p min_subnorm +log1p -min +log1p -min_subnorm log1p 0x1p10 log1p 0x1p20 log1p 0x1p30 diff --git a/math/auto-libm-test-out b/math/auto-libm-test-out index 0d7fac54d6..7c8a3fb8ff 100644 --- a/math/auto-libm-test-out +++ b/math/auto-libm-test-out @@ -143235,7 +143235,7 @@ log1p -0.875 = log1p tonearest ldbl-128ibm -0xep-4L : -0x2.145647e7756e6d035dab1ac80cp+0L : inexact-ok = log1p towardzero ldbl-128ibm -0xep-4L : -0x2.145647e7756e6d035dab1ac80bp+0L : inexact-ok = log1p upward ldbl-128ibm -0xep-4L : -0x2.145647e7756e6d035dab1ac80bp+0L : inexact-ok -log1p min missing-underflow +log1p min = log1p downward flt-32 0x4p-128f : 0x3.fffff8p-128f : inexact-ok underflow-ok errno-erange-ok = log1p tonearest flt-32 0x4p-128f : 0x4p-128f : inexact-ok underflow-ok errno-erange-ok = log1p towardzero flt-32 0x4p-128f : 0x3.fffff8p-128f : inexact-ok underflow-ok errno-erange-ok @@ -143276,10 +143276,10 @@ log1p min missing-underflow = log1p tonearest ldbl-128 0x4p-1024L : 0x4p-1024L : inexact-ok = log1p towardzero ldbl-128 0x4p-1024L : 0x3.fffffffffffffffffffffffffffep-1024L : inexact-ok = log1p upward ldbl-128 0x4p-1024L : 0x4p-1024L : inexact-ok -= log1p downward ldbl-128ibm 0x4p-1024L : 0x3.ffffffffffffcp-1024L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest ldbl-128ibm 0x4p-1024L : 0x4p-1024L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero ldbl-128ibm 0x4p-1024L : 0x3.ffffffffffffcp-1024L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward ldbl-128ibm 0x4p-1024L : 0x4p-1024L : inexact-ok underflow underflow-ok errno-erange-ok += log1p downward ldbl-128ibm 0x4p-1024L : 0x3.ffffffffffffcp-1024L : inexact-ok underflow errno-erange-ok += log1p tonearest ldbl-128ibm 0x4p-1024L : 0x4p-1024L : inexact-ok underflow errno-erange-ok += log1p towardzero ldbl-128ibm 0x4p-1024L : 0x3.ffffffffffffcp-1024L : inexact-ok underflow errno-erange-ok += log1p upward ldbl-128ibm 0x4p-1024L : 0x4p-1024L : inexact-ok underflow errno-erange-ok = log1p downward ldbl-96-intel 0x4p-16384L : 0x3.fffffffffffffff8p-16384L : inexact-ok underflow-ok errno-erange-ok = log1p tonearest ldbl-96-intel 0x4p-16384L : 0x4p-16384L : inexact-ok underflow-ok errno-erange-ok = log1p towardzero ldbl-96-intel 0x4p-16384L : 0x3.fffffffffffffff8p-16384L : inexact-ok underflow-ok errno-erange-ok @@ -143292,18 +143292,18 @@ log1p min missing-underflow = log1p tonearest ldbl-128 0x4p-16384L : 0x4p-16384L : inexact-ok underflow-ok errno-erange-ok = log1p towardzero ldbl-128 0x4p-16384L : 0x3.fffffffffffffffffffffffffffcp-16384L : inexact-ok underflow-ok errno-erange-ok = log1p upward ldbl-128 0x4p-16384L : 0x4p-16384L : inexact-ok underflow-ok errno-erange-ok -= log1p downward ldbl-96-intel 0x2p-16384L : 0x1.fffffffffffffff8p-16384L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest ldbl-96-intel 0x2p-16384L : 0x2p-16384L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero ldbl-96-intel 0x2p-16384L : 0x1.fffffffffffffff8p-16384L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward ldbl-96-intel 0x2p-16384L : 0x2p-16384L : inexact-ok underflow underflow-ok errno-erange-ok += log1p downward ldbl-96-intel 0x2p-16384L : 0x1.fffffffffffffff8p-16384L : inexact-ok underflow errno-erange-ok += log1p tonearest ldbl-96-intel 0x2p-16384L : 0x2p-16384L : inexact-ok underflow errno-erange-ok += log1p towardzero ldbl-96-intel 0x2p-16384L : 0x1.fffffffffffffff8p-16384L : inexact-ok underflow errno-erange-ok += log1p upward ldbl-96-intel 0x2p-16384L : 0x2p-16384L : inexact-ok underflow errno-erange-ok = log1p downward ldbl-96-m68k 0x2p-16384L : 0x1.fffffffffffffffcp-16384L : inexact-ok underflow-ok errno-erange-ok = log1p tonearest ldbl-96-m68k 0x2p-16384L : 0x2p-16384L : inexact-ok underflow-ok errno-erange-ok = log1p towardzero ldbl-96-m68k 0x2p-16384L : 0x1.fffffffffffffffcp-16384L : inexact-ok underflow-ok errno-erange-ok = log1p upward ldbl-96-m68k 0x2p-16384L : 0x2p-16384L : inexact-ok underflow-ok errno-erange-ok -= log1p downward ldbl-128 0x2p-16384L : 0x1.fffffffffffffffffffffffffffcp-16384L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest ldbl-128 0x2p-16384L : 0x2p-16384L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero ldbl-128 0x2p-16384L : 0x1.fffffffffffffffffffffffffffcp-16384L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward ldbl-128 0x2p-16384L : 0x2p-16384L : inexact-ok underflow underflow-ok errno-erange-ok += log1p downward ldbl-128 0x2p-16384L : 0x1.fffffffffffffffffffffffffffcp-16384L : inexact-ok underflow errno-erange-ok += log1p tonearest ldbl-128 0x2p-16384L : 0x2p-16384L : inexact-ok underflow errno-erange-ok += log1p towardzero ldbl-128 0x2p-16384L : 0x1.fffffffffffffffffffffffffffcp-16384L : inexact-ok underflow errno-erange-ok += log1p upward ldbl-128 0x2p-16384L : 0x2p-16384L : inexact-ok underflow errno-erange-ok = log1p downward dbl-64 0x8p-972 : 0x7.ffffffffffffcp-972 : inexact-ok = log1p tonearest dbl-64 0x8p-972 : 0x8p-972 : inexact-ok = log1p towardzero dbl-64 0x8p-972 : 0x7.ffffffffffffcp-972 : inexact-ok @@ -143324,11 +143324,11 @@ log1p min missing-underflow = log1p tonearest ldbl-128ibm 0x8p-972L : 0x8p-972L : inexact-ok underflow-ok errno-erange-ok = log1p towardzero ldbl-128ibm 0x8p-972L : 0x7.fffffffffffffffffffffffffcp-972L : inexact-ok underflow-ok errno-erange-ok = log1p upward ldbl-128ibm 0x8p-972L : 0x8p-972L : inexact-ok underflow-ok errno-erange-ok -log1p min_subnorm missing-underflow -= log1p downward flt-32 0x8p-152f : 0x0p+0f : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest flt-32 0x8p-152f : 0x8p-152f : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero flt-32 0x8p-152f : 0x0p+0f : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward flt-32 0x8p-152f : 0x8p-152f : inexact-ok underflow underflow-ok errno-erange-ok +log1p min_subnorm += log1p downward flt-32 0x8p-152f : 0x0p+0f : inexact-ok underflow errno-erange-ok += log1p tonearest flt-32 0x8p-152f : 0x8p-152f : inexact-ok underflow errno-erange-ok += log1p towardzero flt-32 0x8p-152f : 0x0p+0f : inexact-ok underflow errno-erange-ok += log1p upward flt-32 0x8p-152f : 0x8p-152f : inexact-ok underflow errno-erange-ok = log1p downward dbl-64 0x8p-152 : 0x7.ffffffffffffcp-152 : inexact-ok = log1p tonearest dbl-64 0x8p-152 : 0x8p-152 : inexact-ok = log1p towardzero dbl-64 0x8p-152 : 0x7.ffffffffffffcp-152 : inexact-ok @@ -143349,10 +143349,10 @@ log1p min_subnorm missing-underflow = log1p tonearest ldbl-128ibm 0x8p-152L : 0x8p-152L : inexact-ok = log1p towardzero ldbl-128ibm 0x8p-152L : 0x7.fffffffffffffffffffffffffep-152L : inexact-ok = log1p upward ldbl-128ibm 0x8p-152L : 0x8p-152L : inexact-ok -= log1p downward dbl-64 0x4p-1076 : 0x0p+0 : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest dbl-64 0x4p-1076 : 0x4p-1076 : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero dbl-64 0x4p-1076 : 0x0p+0 : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward dbl-64 0x4p-1076 : 0x4p-1076 : inexact-ok underflow underflow-ok errno-erange-ok += log1p downward dbl-64 0x4p-1076 : 0x0p+0 : inexact-ok underflow errno-erange-ok += log1p tonearest dbl-64 0x4p-1076 : 0x4p-1076 : inexact-ok underflow errno-erange-ok += log1p towardzero dbl-64 0x4p-1076 : 0x0p+0 : inexact-ok underflow errno-erange-ok += log1p upward dbl-64 0x4p-1076 : 0x4p-1076 : inexact-ok underflow errno-erange-ok = log1p downward ldbl-96-intel 0x4p-1076L : 0x3.fffffffffffffffcp-1076L : inexact-ok = log1p tonearest ldbl-96-intel 0x4p-1076L : 0x4p-1076L : inexact-ok = log1p towardzero ldbl-96-intel 0x4p-1076L : 0x3.fffffffffffffffcp-1076L : inexact-ok @@ -143365,35 +143365,35 @@ log1p min_subnorm missing-underflow = log1p tonearest ldbl-128 0x4p-1076L : 0x4p-1076L : inexact-ok = log1p towardzero ldbl-128 0x4p-1076L : 0x3.fffffffffffffffffffffffffffep-1076L : inexact-ok = log1p upward ldbl-128 0x4p-1076L : 0x4p-1076L : inexact-ok -= log1p downward ldbl-128ibm 0x4p-1076L : 0x0p+0L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest ldbl-128ibm 0x4p-1076L : 0x4p-1076L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero ldbl-128ibm 0x4p-1076L : 0x0p+0L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward ldbl-128ibm 0x4p-1076L : 0x4p-1076L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p downward ldbl-96-intel 0x8p-16448L : 0x0p+0L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest ldbl-96-intel 0x8p-16448L : 0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero ldbl-96-intel 0x8p-16448L : 0x0p+0L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward ldbl-96-intel 0x8p-16448L : 0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p downward ldbl-96-m68k 0x8p-16448L : 0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest ldbl-96-m68k 0x8p-16448L : 0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero ldbl-96-m68k 0x8p-16448L : 0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward ldbl-96-m68k 0x8p-16448L : 0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p downward ldbl-128 0x8p-16448L : 0x7.fffffffffffcp-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest ldbl-128 0x8p-16448L : 0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero ldbl-128 0x8p-16448L : 0x7.fffffffffffcp-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward ldbl-128 0x8p-16448L : 0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p downward ldbl-96-m68k 0x4p-16448L : 0x0p+0L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest ldbl-96-m68k 0x4p-16448L : 0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero ldbl-96-m68k 0x4p-16448L : 0x0p+0L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward ldbl-96-m68k 0x4p-16448L : 0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p downward ldbl-128 0x4p-16448L : 0x3.fffffffffffcp-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest ldbl-128 0x4p-16448L : 0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero ldbl-128 0x4p-16448L : 0x3.fffffffffffcp-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward ldbl-128 0x4p-16448L : 0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p downward ldbl-128 0x4p-16496L : 0x0p+0L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest ldbl-128 0x4p-16496L : 0x4p-16496L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero ldbl-128 0x4p-16496L : 0x0p+0L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward ldbl-128 0x4p-16496L : 0x4p-16496L : inexact-ok underflow underflow-ok errno-erange-ok -log1p -min missing-underflow += log1p downward ldbl-128ibm 0x4p-1076L : 0x0p+0L : inexact-ok underflow errno-erange-ok += log1p tonearest ldbl-128ibm 0x4p-1076L : 0x4p-1076L : inexact-ok underflow errno-erange-ok += log1p towardzero ldbl-128ibm 0x4p-1076L : 0x0p+0L : inexact-ok underflow errno-erange-ok += log1p upward ldbl-128ibm 0x4p-1076L : 0x4p-1076L : inexact-ok underflow errno-erange-ok += log1p downward ldbl-96-intel 0x8p-16448L : 0x0p+0L : inexact-ok underflow errno-erange-ok += log1p tonearest ldbl-96-intel 0x8p-16448L : 0x8p-16448L : inexact-ok underflow errno-erange-ok += log1p towardzero ldbl-96-intel 0x8p-16448L : 0x0p+0L : inexact-ok underflow errno-erange-ok += log1p upward ldbl-96-intel 0x8p-16448L : 0x8p-16448L : inexact-ok underflow errno-erange-ok += log1p downward ldbl-96-m68k 0x8p-16448L : 0x4p-16448L : inexact-ok underflow errno-erange-ok += log1p tonearest ldbl-96-m68k 0x8p-16448L : 0x8p-16448L : inexact-ok underflow errno-erange-ok += log1p towardzero ldbl-96-m68k 0x8p-16448L : 0x4p-16448L : inexact-ok underflow errno-erange-ok += log1p upward ldbl-96-m68k 0x8p-16448L : 0x8p-16448L : inexact-ok underflow errno-erange-ok += log1p downward ldbl-128 0x8p-16448L : 0x7.fffffffffffcp-16448L : inexact-ok underflow errno-erange-ok += log1p tonearest ldbl-128 0x8p-16448L : 0x8p-16448L : inexact-ok underflow errno-erange-ok += log1p towardzero ldbl-128 0x8p-16448L : 0x7.fffffffffffcp-16448L : inexact-ok underflow errno-erange-ok += log1p upward ldbl-128 0x8p-16448L : 0x8p-16448L : inexact-ok underflow errno-erange-ok += log1p downward ldbl-96-m68k 0x4p-16448L : 0x0p+0L : inexact-ok underflow errno-erange-ok += log1p tonearest ldbl-96-m68k 0x4p-16448L : 0x4p-16448L : inexact-ok underflow errno-erange-ok += log1p towardzero ldbl-96-m68k 0x4p-16448L : 0x0p+0L : inexact-ok underflow errno-erange-ok += log1p upward ldbl-96-m68k 0x4p-16448L : 0x4p-16448L : inexact-ok underflow errno-erange-ok += log1p downward ldbl-128 0x4p-16448L : 0x3.fffffffffffcp-16448L : inexact-ok underflow errno-erange-ok += log1p tonearest ldbl-128 0x4p-16448L : 0x4p-16448L : inexact-ok underflow errno-erange-ok += log1p towardzero ldbl-128 0x4p-16448L : 0x3.fffffffffffcp-16448L : inexact-ok underflow errno-erange-ok += log1p upward ldbl-128 0x4p-16448L : 0x4p-16448L : inexact-ok underflow errno-erange-ok += log1p downward ldbl-128 0x4p-16496L : 0x0p+0L : inexact-ok underflow errno-erange-ok += log1p tonearest ldbl-128 0x4p-16496L : 0x4p-16496L : inexact-ok underflow errno-erange-ok += log1p towardzero ldbl-128 0x4p-16496L : 0x0p+0L : inexact-ok underflow errno-erange-ok += log1p upward ldbl-128 0x4p-16496L : 0x4p-16496L : inexact-ok underflow errno-erange-ok +log1p -min = log1p downward flt-32 -0x4p-128f : -0x4.000008p-128f : inexact-ok underflow-ok errno-erange-ok = log1p tonearest flt-32 -0x4p-128f : -0x4p-128f : inexact-ok underflow-ok errno-erange-ok = log1p towardzero flt-32 -0x4p-128f : -0x4p-128f : inexact-ok underflow-ok errno-erange-ok @@ -143434,10 +143434,10 @@ log1p -min missing-underflow = log1p tonearest ldbl-128 -0x4p-1024L : -0x4p-1024L : inexact-ok = log1p towardzero ldbl-128 -0x4p-1024L : -0x4p-1024L : inexact-ok = log1p upward ldbl-128 -0x4p-1024L : -0x4p-1024L : inexact-ok -= log1p downward ldbl-128ibm -0x4p-1024L : -0x4.0000000000004p-1024L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest ldbl-128ibm -0x4p-1024L : -0x4p-1024L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero ldbl-128ibm -0x4p-1024L : -0x4p-1024L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward ldbl-128ibm -0x4p-1024L : -0x4p-1024L : inexact-ok underflow underflow-ok errno-erange-ok += log1p downward ldbl-128ibm -0x4p-1024L : -0x4.0000000000004p-1024L : inexact-ok underflow errno-erange-ok += log1p tonearest ldbl-128ibm -0x4p-1024L : -0x4p-1024L : inexact-ok underflow errno-erange-ok += log1p towardzero ldbl-128ibm -0x4p-1024L : -0x4p-1024L : inexact-ok underflow errno-erange-ok += log1p upward ldbl-128ibm -0x4p-1024L : -0x4p-1024L : inexact-ok underflow errno-erange-ok = log1p downward ldbl-96-intel -0x4p-16384L : -0x4.0000000000000008p-16384L : inexact-ok underflow-ok errno-erange-ok = log1p tonearest ldbl-96-intel -0x4p-16384L : -0x4p-16384L : inexact-ok underflow-ok errno-erange-ok = log1p towardzero ldbl-96-intel -0x4p-16384L : -0x4p-16384L : inexact-ok underflow-ok errno-erange-ok @@ -143450,18 +143450,18 @@ log1p -min missing-underflow = log1p tonearest ldbl-128 -0x4p-16384L : -0x4p-16384L : inexact-ok underflow-ok errno-erange-ok = log1p towardzero ldbl-128 -0x4p-16384L : -0x4p-16384L : inexact-ok underflow-ok errno-erange-ok = log1p upward ldbl-128 -0x4p-16384L : -0x4p-16384L : inexact-ok underflow-ok errno-erange-ok -= log1p downward ldbl-96-intel -0x2p-16384L : -0x2.0000000000000008p-16384L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest ldbl-96-intel -0x2p-16384L : -0x2p-16384L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero ldbl-96-intel -0x2p-16384L : -0x2p-16384L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward ldbl-96-intel -0x2p-16384L : -0x2p-16384L : inexact-ok underflow underflow-ok errno-erange-ok += log1p downward ldbl-96-intel -0x2p-16384L : -0x2.0000000000000008p-16384L : inexact-ok underflow errno-erange-ok += log1p tonearest ldbl-96-intel -0x2p-16384L : -0x2p-16384L : inexact-ok underflow errno-erange-ok += log1p towardzero ldbl-96-intel -0x2p-16384L : -0x2p-16384L : inexact-ok underflow errno-erange-ok += log1p upward ldbl-96-intel -0x2p-16384L : -0x2p-16384L : inexact-ok underflow errno-erange-ok = log1p downward ldbl-96-m68k -0x2p-16384L : -0x2.0000000000000004p-16384L : inexact-ok underflow-ok errno-erange-ok = log1p tonearest ldbl-96-m68k -0x2p-16384L : -0x2p-16384L : inexact-ok underflow-ok errno-erange-ok = log1p towardzero ldbl-96-m68k -0x2p-16384L : -0x2p-16384L : inexact-ok underflow-ok errno-erange-ok = log1p upward ldbl-96-m68k -0x2p-16384L : -0x2p-16384L : inexact-ok underflow-ok errno-erange-ok -= log1p downward ldbl-128 -0x2p-16384L : -0x2.0000000000000000000000000004p-16384L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest ldbl-128 -0x2p-16384L : -0x2p-16384L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero ldbl-128 -0x2p-16384L : -0x2p-16384L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward ldbl-128 -0x2p-16384L : -0x2p-16384L : inexact-ok underflow underflow-ok errno-erange-ok += log1p downward ldbl-128 -0x2p-16384L : -0x2.0000000000000000000000000004p-16384L : inexact-ok underflow errno-erange-ok += log1p tonearest ldbl-128 -0x2p-16384L : -0x2p-16384L : inexact-ok underflow errno-erange-ok += log1p towardzero ldbl-128 -0x2p-16384L : -0x2p-16384L : inexact-ok underflow errno-erange-ok += log1p upward ldbl-128 -0x2p-16384L : -0x2p-16384L : inexact-ok underflow errno-erange-ok = log1p downward dbl-64 -0x8p-972 : -0x8.0000000000008p-972 : inexact-ok = log1p tonearest dbl-64 -0x8p-972 : -0x8p-972 : inexact-ok = log1p towardzero dbl-64 -0x8p-972 : -0x8p-972 : inexact-ok @@ -143482,11 +143482,11 @@ log1p -min missing-underflow = log1p tonearest ldbl-128ibm -0x8p-972L : -0x8p-972L : inexact-ok underflow-ok errno-erange-ok = log1p towardzero ldbl-128ibm -0x8p-972L : -0x8p-972L : inexact-ok underflow-ok errno-erange-ok = log1p upward ldbl-128ibm -0x8p-972L : -0x8p-972L : inexact-ok underflow-ok errno-erange-ok -log1p -min_subnorm missing-underflow -= log1p downward flt-32 -0x8p-152f : -0x1p-148f : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest flt-32 -0x8p-152f : -0x8p-152f : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero flt-32 -0x8p-152f : -0x8p-152f : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward flt-32 -0x8p-152f : -0x8p-152f : inexact-ok underflow underflow-ok errno-erange-ok +log1p -min_subnorm += log1p downward flt-32 -0x8p-152f : -0x1p-148f : inexact-ok underflow errno-erange-ok += log1p tonearest flt-32 -0x8p-152f : -0x8p-152f : inexact-ok underflow errno-erange-ok += log1p towardzero flt-32 -0x8p-152f : -0x8p-152f : inexact-ok underflow errno-erange-ok += log1p upward flt-32 -0x8p-152f : -0x8p-152f : inexact-ok underflow errno-erange-ok = log1p downward dbl-64 -0x8p-152 : -0x8.0000000000008p-152 : inexact-ok = log1p tonearest dbl-64 -0x8p-152 : -0x8p-152 : inexact-ok = log1p towardzero dbl-64 -0x8p-152 : -0x8p-152 : inexact-ok @@ -143507,10 +143507,10 @@ log1p -min_subnorm missing-underflow = log1p tonearest ldbl-128ibm -0x8p-152L : -0x8p-152L : inexact-ok = log1p towardzero ldbl-128ibm -0x8p-152L : -0x8p-152L : inexact-ok = log1p upward ldbl-128ibm -0x8p-152L : -0x8p-152L : inexact-ok -= log1p downward dbl-64 -0x4p-1076 : -0x8p-1076 : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest dbl-64 -0x4p-1076 : -0x4p-1076 : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero dbl-64 -0x4p-1076 : -0x4p-1076 : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward dbl-64 -0x4p-1076 : -0x4p-1076 : inexact-ok underflow underflow-ok errno-erange-ok += log1p downward dbl-64 -0x4p-1076 : -0x8p-1076 : inexact-ok underflow errno-erange-ok += log1p tonearest dbl-64 -0x4p-1076 : -0x4p-1076 : inexact-ok underflow errno-erange-ok += log1p towardzero dbl-64 -0x4p-1076 : -0x4p-1076 : inexact-ok underflow errno-erange-ok += log1p upward dbl-64 -0x4p-1076 : -0x4p-1076 : inexact-ok underflow errno-erange-ok = log1p downward ldbl-96-intel -0x4p-1076L : -0x4.0000000000000008p-1076L : inexact-ok = log1p tonearest ldbl-96-intel -0x4p-1076L : -0x4p-1076L : inexact-ok = log1p towardzero ldbl-96-intel -0x4p-1076L : -0x4p-1076L : inexact-ok @@ -143523,34 +143523,34 @@ log1p -min_subnorm missing-underflow = log1p tonearest ldbl-128 -0x4p-1076L : -0x4p-1076L : inexact-ok = log1p towardzero ldbl-128 -0x4p-1076L : -0x4p-1076L : inexact-ok = log1p upward ldbl-128 -0x4p-1076L : -0x4p-1076L : inexact-ok -= log1p downward ldbl-128ibm -0x4p-1076L : -0x8p-1076L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest ldbl-128ibm -0x4p-1076L : -0x4p-1076L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero ldbl-128ibm -0x4p-1076L : -0x4p-1076L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward ldbl-128ibm -0x4p-1076L : -0x4p-1076L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p downward ldbl-96-intel -0x8p-16448L : -0x1p-16444L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest ldbl-96-intel -0x8p-16448L : -0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero ldbl-96-intel -0x8p-16448L : -0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward ldbl-96-intel -0x8p-16448L : -0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p downward ldbl-96-m68k -0x8p-16448L : -0xcp-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest ldbl-96-m68k -0x8p-16448L : -0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero ldbl-96-m68k -0x8p-16448L : -0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward ldbl-96-m68k -0x8p-16448L : -0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p downward ldbl-128 -0x8p-16448L : -0x8.000000000004p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest ldbl-128 -0x8p-16448L : -0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero ldbl-128 -0x8p-16448L : -0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward ldbl-128 -0x8p-16448L : -0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p downward ldbl-96-m68k -0x4p-16448L : -0x8p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest ldbl-96-m68k -0x4p-16448L : -0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero ldbl-96-m68k -0x4p-16448L : -0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward ldbl-96-m68k -0x4p-16448L : -0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p downward ldbl-128 -0x4p-16448L : -0x4.000000000004p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest ldbl-128 -0x4p-16448L : -0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero ldbl-128 -0x4p-16448L : -0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward ldbl-128 -0x4p-16448L : -0x4p-16448L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p downward ldbl-128 -0x4p-16496L : -0x8p-16496L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p tonearest ldbl-128 -0x4p-16496L : -0x4p-16496L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p towardzero ldbl-128 -0x4p-16496L : -0x4p-16496L : inexact-ok underflow underflow-ok errno-erange-ok -= log1p upward ldbl-128 -0x4p-16496L : -0x4p-16496L : inexact-ok underflow underflow-ok errno-erange-ok += log1p downward ldbl-128ibm -0x4p-1076L : -0x8p-1076L : inexact-ok underflow errno-erange-ok += log1p tonearest ldbl-128ibm -0x4p-1076L : -0x4p-1076L : inexact-ok underflow errno-erange-ok += log1p towardzero ldbl-128ibm -0x4p-1076L : -0x4p-1076L : inexact-ok underflow errno-erange-ok += log1p upward ldbl-128ibm -0x4p-1076L : -0x4p-1076L : inexact-ok underflow errno-erange-ok += log1p downward ldbl-96-intel -0x8p-16448L : -0x1p-16444L : inexact-ok underflow errno-erange-ok += log1p tonearest ldbl-96-intel -0x8p-16448L : -0x8p-16448L : inexact-ok underflow errno-erange-ok += log1p towardzero ldbl-96-intel -0x8p-16448L : -0x8p-16448L : inexact-ok underflow errno-erange-ok += log1p upward ldbl-96-intel -0x8p-16448L : -0x8p-16448L : inexact-ok underflow errno-erange-ok += log1p downward ldbl-96-m68k -0x8p-16448L : -0xcp-16448L : inexact-ok underflow errno-erange-ok += log1p tonearest ldbl-96-m68k -0x8p-16448L : -0x8p-16448L : inexact-ok underflow errno-erange-ok += log1p towardzero ldbl-96-m68k -0x8p-16448L : -0x8p-16448L : inexact-ok underflow errno-erange-ok += log1p upward ldbl-96-m68k -0x8p-16448L : -0x8p-16448L : inexact-ok underflow errno-erange-ok += log1p downward ldbl-128 -0x8p-16448L : -0x8.000000000004p-16448L : inexact-ok underflow errno-erange-ok += log1p tonearest ldbl-128 -0x8p-16448L : -0x8p-16448L : inexact-ok underflow errno-erange-ok += log1p towardzero ldbl-128 -0x8p-16448L : -0x8p-16448L : inexact-ok underflow errno-erange-ok += log1p upward ldbl-128 -0x8p-16448L : -0x8p-16448L : inexact-ok underflow errno-erange-ok += log1p downward ldbl-96-m68k -0x4p-16448L : -0x8p-16448L : inexact-ok underflow errno-erange-ok += log1p tonearest ldbl-96-m68k -0x4p-16448L : -0x4p-16448L : inexact-ok underflow errno-erange-ok += log1p towardzero ldbl-96-m68k -0x4p-16448L : -0x4p-16448L : inexact-ok underflow errno-erange-ok += log1p upward ldbl-96-m68k -0x4p-16448L : -0x4p-16448L : inexact-ok underflow errno-erange-ok += log1p downward ldbl-128 -0x4p-16448L : -0x4.000000000004p-16448L : inexact-ok underflow errno-erange-ok += log1p tonearest ldbl-128 -0x4p-16448L : -0x4p-16448L : inexact-ok underflow errno-erange-ok += log1p towardzero ldbl-128 -0x4p-16448L : -0x4p-16448L : inexact-ok underflow errno-erange-ok += log1p upward ldbl-128 -0x4p-16448L : -0x4p-16448L : inexact-ok underflow errno-erange-ok += log1p downward ldbl-128 -0x4p-16496L : -0x8p-16496L : inexact-ok underflow errno-erange-ok += log1p tonearest ldbl-128 -0x4p-16496L : -0x4p-16496L : inexact-ok underflow errno-erange-ok += log1p towardzero ldbl-128 -0x4p-16496L : -0x4p-16496L : inexact-ok underflow errno-erange-ok += log1p upward ldbl-128 -0x4p-16496L : -0x4p-16496L : inexact-ok underflow errno-erange-ok log1p 0x1p10 = log1p downward flt-32 0x4p+8f : 0x6.eeb4ep+0f : inexact-ok = log1p tonearest flt-32 0x4p+8f : 0x6.eeb4e8p+0f : inexact-ok diff --git a/sysdeps/i386/fpu/s_log1p.S b/sysdeps/i386/fpu/s_log1p.S index 8624249dba..c2559a3f18 100644 --- a/sysdeps/i386/fpu/s_log1p.S +++ b/sysdeps/i386/fpu/s_log1p.S @@ -17,6 +17,13 @@ RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp $") limit: .double 0.29 one: .double 1.0 + .section .rodata.cst8,"aM",@progbits,8 + + .p2align 3 + .type dbl_min,@object +dbl_min: .byte 0, 0, 0, 0, 0, 0, 0x10, 0 + ASM_SIZE_DIRECTIVE(dbl_min) + /* * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29, * otherwise fyl2x with the needed extra computation. @@ -55,7 +62,25 @@ ENTRY(__log1p) ret 2: fyl2xp1 - ret +#ifdef PIC + fldl dbl_min@GOTOFF(%edx) +#else + fldl dbl_min +#endif + fld %st(1) + fabs + fucompp + fnstsw + sahf + jnc 1f + subl $8, %esp + cfi_adjust_cfa_offset (8) + fld %st(0) + fmul %st(0) + fstpl (%esp) + addl $8, %esp + cfi_adjust_cfa_offset (-8) +1: ret 3: jp 4b // in case x is ±Inf fstp %st(1) diff --git a/sysdeps/i386/fpu/s_log1pf.S b/sysdeps/i386/fpu/s_log1pf.S index b071e7372d..8fca22e4ff 100644 --- a/sysdeps/i386/fpu/s_log1pf.S +++ b/sysdeps/i386/fpu/s_log1pf.S @@ -17,6 +17,13 @@ RCSID("$NetBSD: s_log1pf.S,v 1.4 1995/05/09 00:13:05 jtc Exp $") limit: .float 0.29 one: .float 1.0 + .section .rodata.cst4,"aM",@progbits,4 + + .p2align 2 + .type flt_min,@object +flt_min: .byte 0, 0, 0x80, 0 + ASM_SIZE_DIRECTIVE(flt_min) + /* * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29, * otherwise fyl2x with the needed extra computation. @@ -55,7 +62,25 @@ ENTRY(__log1pf) ret 2: fyl2xp1 - ret +#ifdef PIC + flds flt_min@GOTOFF(%edx) +#else + flds flt_min +#endif + fld %st(1) + fabs + fucompp + fnstsw + sahf + jnc 1f + subl $4, %esp + cfi_adjust_cfa_offset (4) + fld %st(0) + fmul %st(0) + fstps (%esp) + addl $4, %esp + cfi_adjust_cfa_offset (-4) +1: ret 3: jp 4b // in case x is ±Inf fstp %st(1) diff --git a/sysdeps/ieee754/dbl-64/s_log1p.c b/sysdeps/ieee754/dbl-64/s_log1p.c index 86bbfbacaf..cff555b0aa 100644 --- a/sysdeps/ieee754/dbl-64/s_log1p.c +++ b/sysdeps/ieee754/dbl-64/s_log1p.c @@ -78,6 +78,7 @@ * See HP-15C Advanced Functions Handbook, p.193. */ +#include #include #include @@ -118,7 +119,14 @@ __log1p (double x) { math_force_eval (two54 + x); /* raise inexact */ if (ax < 0x3c900000) /* |x| < 2**-54 */ - return x; + { + if (fabs (x) < DBL_MIN) + { + double force_underflow = x * x; + math_force_eval (force_underflow); + } + return x; + } else return x - x * x * 0.5; } diff --git a/sysdeps/ieee754/flt-32/s_log1pf.c b/sysdeps/ieee754/flt-32/s_log1pf.c index 94c33fca16..83a09f1414 100644 --- a/sysdeps/ieee754/flt-32/s_log1pf.c +++ b/sysdeps/ieee754/flt-32/s_log1pf.c @@ -13,6 +13,7 @@ * ==================================================== */ +#include #include #include @@ -48,7 +49,14 @@ __log1pf(float x) if(ax<0x31000000) { /* |x| < 2**-29 */ math_force_eval(two25+x); /* raise inexact */ if (ax<0x24800000) /* |x| < 2**-54 */ + { + if (fabsf (x) < FLT_MIN) + { + float force_underflow = x * x; + math_force_eval (force_underflow); + } return x; + } else return x - x*x*(float)0.5; } diff --git a/sysdeps/ieee754/ldbl-128/s_log1pl.c b/sysdeps/ieee754/ldbl-128/s_log1pl.c index b70a55b758..ff759bc000 100644 --- a/sysdeps/ieee754/ldbl-128/s_log1pl.c +++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c @@ -53,6 +53,7 @@ . */ +#include #include #include @@ -140,6 +141,11 @@ __log1pl (long double xm1) if ((hx & 0x7fffffff) < 0x3f8e0000) { + if (fabsl (xm1) < LDBL_MIN) + { + long double force_underflow = xm1 * xm1; + math_force_eval (force_underflow); + } if ((int) xm1 == 0) return xm1; } -- cgit v1.2.3