From 1a84c3d6d4bc43c92b6531b09d732e2e9c750dea Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 14 May 2014 12:38:56 +0000 Subject: [PATCH] Fix log1pl (LDBL_MAX) in FE_UPWARD mode (bug 16564). Bug 16564 is spurious overflow of log1pl (LDBL_MAX) in FE_UPWARD mode, resulting from log1pl adding 1 to its argument (for arguments not close to 0), which overflows in that mode. This patch fixes this by avoiding adding 1 to large arguments (precisely what counts as large depends on the floating-point format). Tested x86_64 and x86, and spot-checked log1pl tests on mips64 and powerpc64. [BZ #16564] * sysdeps/i386/fpu/s_log1pl.S (__log1pl): Do not add 1 to positive arguments with exponent 65 or above. * sysdeps/ieee754/ldbl-128/s_log1pl.c (__log1pl): Do not add 1 to arguments 0x1p113L or above. * sysdeps/ieee754/ldbl-128ibm/s_log1pl.c (__log1pl): Do not add 1 to arguments 0x1p107L or above. * sysdeps/x86_64/fpu/s_log1pl.S (__log1pl): Do not add 1 to positive arguments with exponent 65 or above. * math/auto-libm-test-in: Add more tests of log1p. * math/auto-libm-test-out: Regenerated. --- ChangeLog | 12 ++ NEWS | 14 +- math/auto-libm-test-in | 8 + math/auto-libm-test-out | 264 +++++++++++++++++++++++++ sysdeps/i386/fpu/s_log1pl.S | 7 +- sysdeps/ieee754/ldbl-128/s_log1pl.c | 5 +- sysdeps/ieee754/ldbl-128ibm/s_log1pl.c | 5 +- sysdeps/x86_64/fpu/s_log1pl.S | 7 +- 8 files changed, 311 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 37ca8c03be..0bcf74831e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2014-05-14 Joseph Myers + [BZ #16564] + * sysdeps/i386/fpu/s_log1pl.S (__log1pl): Do not add 1 to positive + arguments with exponent 65 or above. + * sysdeps/ieee754/ldbl-128/s_log1pl.c (__log1pl): Do not add 1 to + arguments 0x1p113L or above. + * sysdeps/ieee754/ldbl-128ibm/s_log1pl.c (__log1pl): Do not add 1 + to arguments 0x1p107L or above. + * sysdeps/x86_64/fpu/s_log1pl.S (__log1pl): Do not add 1 to + positive arguments with exponent 65 or above. + * math/auto-libm-test-in: Add more tests of log1p. + * math/auto-libm-test-out: Regenerated. + [BZ #16928] * math/s_cacos.c (__cacos): Ensure zero real part of result from non-finite arguments is +0. diff --git a/NEWS b/NEWS index de9e8a280e..be88031c1e 100644 --- a/NEWS +++ b/NEWS @@ -11,13 +11,13 @@ Version 2.20 6804, 9894, 12994, 13347, 13651, 14308, 14770, 15119, 15347, 15514, 15804, 15894, 16002, 16064, 16198, 16284, 16348, 16349, 16357, 16362, 16447, - 16516, 16532, 16545, 16574, 16599, 16600, 16609, 16610, 16611, 16613, - 16619, 16623, 16629, 16632, 16634, 16639, 16642, 16648, 16649, 16670, - 16674, 16677, 16680, 16683, 16689, 16695, 16701, 16706, 16707, 16712, - 16713, 16714, 16731, 16739, 16740, 16743, 16754, 16758, 16759, 16760, - 16770, 16786, 16789, 16791, 16799, 16800, 16815, 16823, 16824, 16831, - 16838, 16854, 16876, 16877, 16885, 16888, 16890, 16912, 16916, 16922, - 16927, 16928, 16932. + 16516, 16532, 16545, 16564, 16574, 16599, 16600, 16609, 16610, 16611, + 16613, 16619, 16623, 16629, 16632, 16634, 16639, 16642, 16648, 16649, + 16670, 16674, 16677, 16680, 16683, 16689, 16695, 16701, 16706, 16707, + 16712, 16713, 16714, 16731, 16739, 16740, 16743, 16754, 16758, 16759, + 16760, 16770, 16786, 16789, 16791, 16799, 16800, 16815, 16823, 16824, + 16831, 16838, 16854, 16876, 16877, 16885, 16888, 16890, 16912, 16916, + 16922, 16927, 16928, 16932. * The minimum Linux kernel version that this version of the GNU C Library can be used with is 2.6.32. diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in index da93a302cc..6edad5ad7e 100644 --- a/math/auto-libm-test-in +++ b/math/auto-libm-test-in @@ -1421,6 +1421,14 @@ log1p min missing-underflow log1p min_subnorm missing-underflow log1p -min missing-underflow log1p -min_subnorm missing-underflow +log1p 0x1p10 +log1p 0x1p20 +log1p 0x1p30 +log1p 0x1p50 +log1p 0x1p60 +log1p 0x1p100 +log1p 0x1p1000 +log1p max log2 1 log2 e diff --git a/math/auto-libm-test-out b/math/auto-libm-test-out index a0d919a8bd..9885a55f3b 100644 --- a/math/auto-libm-test-out +++ b/math/auto-libm-test-out @@ -126288,6 +126288,270 @@ log1p -min_subnorm missing-underflow = 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 0x1p10 += log1p downward flt-32 0x4p+8f : 0x6.eeb4ep+0f : inexact-ok += log1p tonearest flt-32 0x4p+8f : 0x6.eeb4e8p+0f : inexact-ok += log1p towardzero flt-32 0x4p+8f : 0x6.eeb4ep+0f : inexact-ok += log1p upward flt-32 0x4p+8f : 0x6.eeb4e8p+0f : inexact-ok += log1p downward dbl-64 0x4p+8 : 0x6.eeb4e7af873p+0 : inexact-ok += log1p tonearest dbl-64 0x4p+8 : 0x6.eeb4e7af87304p+0 : inexact-ok += log1p towardzero dbl-64 0x4p+8 : 0x6.eeb4e7af873p+0 : inexact-ok += log1p upward dbl-64 0x4p+8 : 0x6.eeb4e7af87304p+0 : inexact-ok += log1p downward ldbl-96-intel 0x4p+8L : 0x6.eeb4e7af873022dp+0L : inexact-ok += log1p tonearest ldbl-96-intel 0x4p+8L : 0x6.eeb4e7af873022d8p+0L : inexact-ok += log1p towardzero ldbl-96-intel 0x4p+8L : 0x6.eeb4e7af873022dp+0L : inexact-ok += log1p upward ldbl-96-intel 0x4p+8L : 0x6.eeb4e7af873022d8p+0L : inexact-ok += log1p downward ldbl-96-m68k 0x4p+8L : 0x6.eeb4e7af873022dp+0L : inexact-ok += log1p tonearest ldbl-96-m68k 0x4p+8L : 0x6.eeb4e7af873022d8p+0L : inexact-ok += log1p towardzero ldbl-96-m68k 0x4p+8L : 0x6.eeb4e7af873022dp+0L : inexact-ok += log1p upward ldbl-96-m68k 0x4p+8L : 0x6.eeb4e7af873022d8p+0L : inexact-ok += log1p downward ldbl-128 0x4p+8L : 0x6.eeb4e7af873022d55aeea4934c14p+0L : inexact-ok += log1p tonearest ldbl-128 0x4p+8L : 0x6.eeb4e7af873022d55aeea4934c18p+0L : inexact-ok += log1p towardzero ldbl-128 0x4p+8L : 0x6.eeb4e7af873022d55aeea4934c14p+0L : inexact-ok += log1p upward ldbl-128 0x4p+8L : 0x6.eeb4e7af873022d55aeea4934c18p+0L : inexact-ok += log1p downward ldbl-128ibm 0x4p+8L : 0x6.eeb4e7af873022d55aeea4934cp+0L : inexact-ok += log1p tonearest ldbl-128ibm 0x4p+8L : 0x6.eeb4e7af873022d55aeea4934cp+0L : inexact-ok += log1p towardzero ldbl-128ibm 0x4p+8L : 0x6.eeb4e7af873022d55aeea4934cp+0L : inexact-ok += log1p upward ldbl-128ibm 0x4p+8L : 0x6.eeb4e7af873022d55aeea4934ep+0L : inexact-ok +log1p 0x1p20 += log1p downward flt-32 0x1p+20f : 0xd.dce9ep+0f : inexact-ok += log1p tonearest flt-32 0x1p+20f : 0xd.dce9fp+0f : inexact-ok += log1p towardzero flt-32 0x1p+20f : 0xd.dce9ep+0f : inexact-ok += log1p upward flt-32 0x1p+20f : 0xd.dce9fp+0f : inexact-ok += log1p downward dbl-64 0x1p+20 : 0xd.dce9ef5c63b58p+0 : inexact-ok += log1p tonearest dbl-64 0x1p+20 : 0xd.dce9ef5c63b58p+0 : inexact-ok += log1p towardzero dbl-64 0x1p+20 : 0xd.dce9ef5c63b58p+0 : inexact-ok += log1p upward dbl-64 0x1p+20 : 0xd.dce9ef5c63b6p+0 : inexact-ok += log1p downward ldbl-96-intel 0x1p+20L : 0xd.dce9ef5c63b5817p+0L : inexact-ok += log1p tonearest ldbl-96-intel 0x1p+20L : 0xd.dce9ef5c63b5817p+0L : inexact-ok += log1p towardzero ldbl-96-intel 0x1p+20L : 0xd.dce9ef5c63b5817p+0L : inexact-ok += log1p upward ldbl-96-intel 0x1p+20L : 0xd.dce9ef5c63b5818p+0L : inexact-ok += log1p downward ldbl-96-m68k 0x1p+20L : 0xd.dce9ef5c63b5817p+0L : inexact-ok += log1p tonearest ldbl-96-m68k 0x1p+20L : 0xd.dce9ef5c63b5817p+0L : inexact-ok += log1p towardzero ldbl-96-m68k 0x1p+20L : 0xd.dce9ef5c63b5817p+0L : inexact-ok += log1p upward ldbl-96-m68k 0x1p+20L : 0xd.dce9ef5c63b5818p+0L : inexact-ok += log1p downward ldbl-128 0x1p+20L : 0xd.dce9ef5c63b581711b1f1d35a78p+0L : inexact-ok += log1p tonearest ldbl-128 0x1p+20L : 0xd.dce9ef5c63b581711b1f1d35a78p+0L : inexact-ok += log1p towardzero ldbl-128 0x1p+20L : 0xd.dce9ef5c63b581711b1f1d35a78p+0L : inexact-ok += log1p upward ldbl-128 0x1p+20L : 0xd.dce9ef5c63b581711b1f1d35a788p+0L : inexact-ok += log1p downward ldbl-128ibm 0x1p+20L : 0xd.dce9ef5c63b581711b1f1d35a4p+0L : inexact-ok += log1p tonearest ldbl-128ibm 0x1p+20L : 0xd.dce9ef5c63b581711b1f1d35a8p+0L : inexact-ok += log1p towardzero ldbl-128ibm 0x1p+20L : 0xd.dce9ef5c63b581711b1f1d35a4p+0L : inexact-ok += log1p upward ldbl-128ibm 0x1p+20L : 0xd.dce9ef5c63b581711b1f1d35a8p+0L : inexact-ok +log1p 0x1p30 += log1p downward flt-32 0x4p+28f : 0x1.4cb5ecp+4f : inexact-ok += log1p tonearest flt-32 0x4p+28f : 0x1.4cb5ecp+4f : inexact-ok += log1p towardzero flt-32 0x4p+28f : 0x1.4cb5ecp+4f : inexact-ok += log1p upward flt-32 0x4p+28f : 0x1.4cb5eep+4f : inexact-ok += log1p downward dbl-64 0x4p+28 : 0x1.4cb5ecf0e965p+4 : inexact-ok += log1p tonearest dbl-64 0x4p+28 : 0x1.4cb5ecf0e965p+4 : inexact-ok += log1p towardzero dbl-64 0x4p+28 : 0x1.4cb5ecf0e965p+4 : inexact-ok += log1p upward dbl-64 0x4p+28 : 0x1.4cb5ecf0e9651p+4 : inexact-ok += log1p downward ldbl-96-intel 0x4p+28L : 0x1.4cb5ecf0e965042p+4L : inexact-ok += log1p tonearest ldbl-96-intel 0x4p+28L : 0x1.4cb5ecf0e9650422p+4L : inexact-ok += log1p towardzero ldbl-96-intel 0x4p+28L : 0x1.4cb5ecf0e965042p+4L : inexact-ok += log1p upward ldbl-96-intel 0x4p+28L : 0x1.4cb5ecf0e9650422p+4L : inexact-ok += log1p downward ldbl-96-m68k 0x4p+28L : 0x1.4cb5ecf0e965042p+4L : inexact-ok += log1p tonearest ldbl-96-m68k 0x4p+28L : 0x1.4cb5ecf0e9650422p+4L : inexact-ok += log1p towardzero ldbl-96-m68k 0x4p+28L : 0x1.4cb5ecf0e965042p+4L : inexact-ok += log1p upward ldbl-96-m68k 0x4p+28L : 0x1.4cb5ecf0e9650422p+4L : inexact-ok += log1p downward ldbl-128 0x4p+28L : 0x1.4cb5ecf0e96504219a8af0be5cbcp+4L : inexact-ok += log1p tonearest ldbl-128 0x4p+28L : 0x1.4cb5ecf0e96504219a8af0be5cbdp+4L : inexact-ok += log1p towardzero ldbl-128 0x4p+28L : 0x1.4cb5ecf0e96504219a8af0be5cbcp+4L : inexact-ok += log1p upward ldbl-128 0x4p+28L : 0x1.4cb5ecf0e96504219a8af0be5cbdp+4L : inexact-ok += log1p downward ldbl-128ibm 0x4p+28L : 0x1.4cb5ecf0e96504219a8af0be5c8p+4L : inexact-ok += log1p tonearest ldbl-128ibm 0x4p+28L : 0x1.4cb5ecf0e96504219a8af0be5c8p+4L : inexact-ok += log1p towardzero ldbl-128ibm 0x4p+28L : 0x1.4cb5ecf0e96504219a8af0be5c8p+4L : inexact-ok += log1p upward ldbl-128ibm 0x4p+28L : 0x1.4cb5ecf0e96504219a8af0be5dp+4L : inexact-ok +log1p 0x1p50 += log1p downward flt-32 0x4p+48f : 0x2.2a8488p+4f : inexact-ok += log1p tonearest flt-32 0x4p+48f : 0x2.2a848cp+4f : inexact-ok += log1p towardzero flt-32 0x4p+48f : 0x2.2a8488p+4f : inexact-ok += log1p upward flt-32 0x4p+48f : 0x2.2a848cp+4f : inexact-ok += log1p downward dbl-64 0x4p+48 : 0x2.2a848ae66fa86p+4 : inexact-ok += log1p tonearest dbl-64 0x4p+48 : 0x2.2a848ae66fa86p+4 : inexact-ok += log1p towardzero dbl-64 0x4p+48 : 0x2.2a848ae66fa86p+4 : inexact-ok += log1p upward dbl-64 0x4p+48 : 0x2.2a848ae66fa88p+4 : inexact-ok += log1p downward ldbl-96-intel 0x4p+48L : 0x2.2a848ae66fa86038p+4L : inexact-ok += log1p tonearest ldbl-96-intel 0x4p+48L : 0x2.2a848ae66fa86038p+4L : inexact-ok += log1p towardzero ldbl-96-intel 0x4p+48L : 0x2.2a848ae66fa86038p+4L : inexact-ok += log1p upward ldbl-96-intel 0x4p+48L : 0x2.2a848ae66fa8603cp+4L : inexact-ok += log1p downward ldbl-96-m68k 0x4p+48L : 0x2.2a848ae66fa86038p+4L : inexact-ok += log1p tonearest ldbl-96-m68k 0x4p+48L : 0x2.2a848ae66fa86038p+4L : inexact-ok += log1p towardzero ldbl-96-m68k 0x4p+48L : 0x2.2a848ae66fa86038p+4L : inexact-ok += log1p upward ldbl-96-m68k 0x4p+48L : 0x2.2a848ae66fa8603cp+4L : inexact-ok += log1p downward ldbl-128 0x4p+48L : 0x2.2a848ae66fa86038d6e7913b0bd6p+4L : inexact-ok += log1p tonearest ldbl-128 0x4p+48L : 0x2.2a848ae66fa86038d6e7913b0bd8p+4L : inexact-ok += log1p towardzero ldbl-128 0x4p+48L : 0x2.2a848ae66fa86038d6e7913b0bd6p+4L : inexact-ok += log1p upward ldbl-128 0x4p+48L : 0x2.2a848ae66fa86038d6e7913b0bd8p+4L : inexact-ok += log1p downward ldbl-128ibm 0x4p+48L : 0x2.2a848ae66fa86038d6e7913b0bp+4L : inexact-ok += log1p tonearest ldbl-128ibm 0x4p+48L : 0x2.2a848ae66fa86038d6e7913b0cp+4L : inexact-ok += log1p towardzero ldbl-128ibm 0x4p+48L : 0x2.2a848ae66fa86038d6e7913b0bp+4L : inexact-ok += log1p upward ldbl-128ibm 0x4p+48L : 0x2.2a848ae66fa86038d6e7913b0cp+4L : inexact-ok +log1p 0x1p60 += log1p downward flt-32 0x1p+60f : 0x2.996bd8p+4f : inexact-ok += log1p tonearest flt-32 0x1p+60f : 0x2.996bd8p+4f : inexact-ok += log1p towardzero flt-32 0x1p+60f : 0x2.996bd8p+4f : inexact-ok += log1p upward flt-32 0x1p+60f : 0x2.996bdcp+4f : inexact-ok += log1p downward dbl-64 0x1p+60 : 0x2.996bd9e152cap+4 : inexact-ok += log1p tonearest dbl-64 0x1p+60 : 0x2.996bd9e152cap+4 : inexact-ok += log1p towardzero dbl-64 0x1p+60 : 0x2.996bd9e152cap+4 : inexact-ok += log1p upward dbl-64 0x1p+60 : 0x2.996bd9e152ca2p+4 : inexact-ok += log1p downward ldbl-96-intel 0x1p+60L : 0x2.996bd9e152ca0844p+4L : inexact-ok += log1p tonearest ldbl-96-intel 0x1p+60L : 0x2.996bd9e152ca0844p+4L : inexact-ok += log1p towardzero ldbl-96-intel 0x1p+60L : 0x2.996bd9e152ca0844p+4L : inexact-ok += log1p upward ldbl-96-intel 0x1p+60L : 0x2.996bd9e152ca0848p+4L : inexact-ok += log1p downward ldbl-96-m68k 0x1p+60L : 0x2.996bd9e152ca0844p+4L : inexact-ok += log1p tonearest ldbl-96-m68k 0x1p+60L : 0x2.996bd9e152ca0844p+4L : inexact-ok += log1p towardzero ldbl-96-m68k 0x1p+60L : 0x2.996bd9e152ca0844p+4L : inexact-ok += log1p upward ldbl-96-m68k 0x1p+60L : 0x2.996bd9e152ca0848p+4L : inexact-ok += log1p downward ldbl-128 0x1p+60L : 0x2.996bd9e152ca08453515e17a0ecep+4L : inexact-ok += log1p tonearest ldbl-128 0x1p+60L : 0x2.996bd9e152ca08453515e17a0edp+4L : inexact-ok += log1p towardzero ldbl-128 0x1p+60L : 0x2.996bd9e152ca08453515e17a0ecep+4L : inexact-ok += log1p upward ldbl-128 0x1p+60L : 0x2.996bd9e152ca08453515e17a0edp+4L : inexact-ok += log1p downward ldbl-128ibm 0x1p+60L : 0x2.996bd9e152ca08453515e17a0ep+4L : inexact-ok += log1p tonearest ldbl-128ibm 0x1p+60L : 0x2.996bd9e152ca08453515e17a0fp+4L : inexact-ok += log1p towardzero ldbl-128ibm 0x1p+60L : 0x2.996bd9e152ca08453515e17a0ep+4L : inexact-ok += log1p upward ldbl-128ibm 0x1p+60L : 0x2.996bd9e152ca08453515e17a0fp+4L : inexact-ok +log1p 0x1p100 += log1p downward flt-32 0x1p+100f : 0x4.55091p+4f : inexact-ok += log1p tonearest flt-32 0x1p+100f : 0x4.550918p+4f : inexact-ok += log1p towardzero flt-32 0x1p+100f : 0x4.55091p+4f : inexact-ok += log1p upward flt-32 0x1p+100f : 0x4.550918p+4f : inexact-ok += log1p downward dbl-64 0x1p+100 : 0x4.550915ccdf508p+4 : inexact-ok += log1p tonearest dbl-64 0x1p+100 : 0x4.550915ccdf50cp+4 : inexact-ok += log1p towardzero dbl-64 0x1p+100 : 0x4.550915ccdf508p+4 : inexact-ok += log1p upward dbl-64 0x1p+100 : 0x4.550915ccdf50cp+4 : inexact-ok += log1p downward ldbl-96-intel 0x1p+100L : 0x4.550915ccdf50b87p+4L : inexact-ok += log1p tonearest ldbl-96-intel 0x1p+100L : 0x4.550915ccdf50b87p+4L : inexact-ok += log1p towardzero ldbl-96-intel 0x1p+100L : 0x4.550915ccdf50b87p+4L : inexact-ok += log1p upward ldbl-96-intel 0x1p+100L : 0x4.550915ccdf50b878p+4L : inexact-ok += log1p downward ldbl-96-m68k 0x1p+100L : 0x4.550915ccdf50b87p+4L : inexact-ok += log1p tonearest ldbl-96-m68k 0x1p+100L : 0x4.550915ccdf50b87p+4L : inexact-ok += log1p towardzero ldbl-96-m68k 0x1p+100L : 0x4.550915ccdf50b87p+4L : inexact-ok += log1p upward ldbl-96-m68k 0x1p+100L : 0x4.550915ccdf50b878p+4L : inexact-ok += log1p downward ldbl-128 0x1p+100L : 0x4.550915ccdf50b871adcf227619acp+4L : inexact-ok += log1p tonearest ldbl-128 0x1p+100L : 0x4.550915ccdf50b871adcf227619bp+4L : inexact-ok += log1p towardzero ldbl-128 0x1p+100L : 0x4.550915ccdf50b871adcf227619acp+4L : inexact-ok += log1p upward ldbl-128 0x1p+100L : 0x4.550915ccdf50b871adcf227619bp+4L : inexact-ok += log1p downward ldbl-128ibm 0x1p+100L : 0x4.550915ccdf50b871adcf227618p+4L : inexact-ok += log1p tonearest ldbl-128ibm 0x1p+100L : 0x4.550915ccdf50b871adcf22761ap+4L : inexact-ok += log1p towardzero ldbl-128ibm 0x1p+100L : 0x4.550915ccdf50b871adcf227618p+4L : inexact-ok += log1p upward ldbl-128ibm 0x1p+100L : 0x4.550915ccdf50b871adcf22761ap+4L : inexact-ok +log1p 0x1p1000 += log1p downward flt-32 0xf.fffffp+124f : 0x5.8b90b8p+4f : inexact-ok += log1p tonearest flt-32 0xf.fffffp+124f : 0x5.8b90cp+4f : inexact-ok += log1p towardzero flt-32 0xf.fffffp+124f : 0x5.8b90b8p+4f : inexact-ok += log1p upward flt-32 0xf.fffffp+124f : 0x5.8b90cp+4f : inexact-ok += log1p downward dbl-64 0xf.fffffp+124 : 0x5.8b90bfae8e7bcp+4 : inexact-ok += log1p tonearest dbl-64 0xf.fffffp+124 : 0x5.8b90bfae8e7bcp+4 : inexact-ok += log1p towardzero dbl-64 0xf.fffffp+124 : 0x5.8b90bfae8e7bcp+4 : inexact-ok += log1p upward dbl-64 0xf.fffffp+124 : 0x5.8b90bfae8e7cp+4 : inexact-ok += log1p downward ldbl-96-intel 0xf.fffffp+124L : 0x5.8b90bfae8e7bc558p+4L : inexact-ok += log1p tonearest ldbl-96-intel 0xf.fffffp+124L : 0x5.8b90bfae8e7bc56p+4L : inexact-ok += log1p towardzero ldbl-96-intel 0xf.fffffp+124L : 0x5.8b90bfae8e7bc558p+4L : inexact-ok += log1p upward ldbl-96-intel 0xf.fffffp+124L : 0x5.8b90bfae8e7bc56p+4L : inexact-ok += log1p downward ldbl-96-m68k 0xf.fffffp+124L : 0x5.8b90bfae8e7bc558p+4L : inexact-ok += log1p tonearest ldbl-96-m68k 0xf.fffffp+124L : 0x5.8b90bfae8e7bc56p+4L : inexact-ok += log1p towardzero ldbl-96-m68k 0xf.fffffp+124L : 0x5.8b90bfae8e7bc558p+4L : inexact-ok += log1p upward ldbl-96-m68k 0xf.fffffp+124L : 0x5.8b90bfae8e7bc56p+4L : inexact-ok += log1p downward ldbl-128 0xf.fffffp+124L : 0x5.8b90bfae8e7bc55e4f18476ac64p+4L : inexact-ok += log1p tonearest ldbl-128 0xf.fffffp+124L : 0x5.8b90bfae8e7bc55e4f18476ac644p+4L : inexact-ok += log1p towardzero ldbl-128 0xf.fffffp+124L : 0x5.8b90bfae8e7bc55e4f18476ac64p+4L : inexact-ok += log1p upward ldbl-128 0xf.fffffp+124L : 0x5.8b90bfae8e7bc55e4f18476ac644p+4L : inexact-ok += log1p downward ldbl-128ibm 0xf.fffffp+124L : 0x5.8b90bfae8e7bc55e4f18476ac6p+4L : inexact-ok += log1p tonearest ldbl-128ibm 0xf.fffffp+124L : 0x5.8b90bfae8e7bc55e4f18476ac6p+4L : inexact-ok += log1p towardzero ldbl-128ibm 0xf.fffffp+124L : 0x5.8b90bfae8e7bc55e4f18476ac6p+4L : inexact-ok += log1p upward ldbl-128ibm 0xf.fffffp+124L : 0x5.8b90bfae8e7bc55e4f18476ac8p+4L : inexact-ok += log1p downward dbl-64 0x1p+1000 : 0x2.b525ada00b926p+8 : inexact-ok += log1p tonearest dbl-64 0x1p+1000 : 0x2.b525ada00b928p+8 : inexact-ok += log1p towardzero dbl-64 0x1p+1000 : 0x2.b525ada00b926p+8 : inexact-ok += log1p upward dbl-64 0x1p+1000 : 0x2.b525ada00b928p+8 : inexact-ok += log1p downward ldbl-96-intel 0x1p+1000L : 0x2.b525ada00b927344p+8L : inexact-ok += log1p tonearest ldbl-96-intel 0x1p+1000L : 0x2.b525ada00b927348p+8L : inexact-ok += log1p towardzero ldbl-96-intel 0x1p+1000L : 0x2.b525ada00b927344p+8L : inexact-ok += log1p upward ldbl-96-intel 0x1p+1000L : 0x2.b525ada00b927348p+8L : inexact-ok += log1p downward ldbl-96-m68k 0x1p+1000L : 0x2.b525ada00b927344p+8L : inexact-ok += log1p tonearest ldbl-96-m68k 0x1p+1000L : 0x2.b525ada00b927348p+8L : inexact-ok += log1p towardzero ldbl-96-m68k 0x1p+1000L : 0x2.b525ada00b927344p+8L : inexact-ok += log1p upward ldbl-96-m68k 0x1p+1000L : 0x2.b525ada00b927348p+8L : inexact-ok += log1p downward ldbl-128 0x1p+1000L : 0x2.b525ada00b9273470ca17589cf6cp+8L : inexact-ok += log1p tonearest ldbl-128 0x1p+1000L : 0x2.b525ada00b9273470ca17589cf6ep+8L : inexact-ok += log1p towardzero ldbl-128 0x1p+1000L : 0x2.b525ada00b9273470ca17589cf6cp+8L : inexact-ok += log1p upward ldbl-128 0x1p+1000L : 0x2.b525ada00b9273470ca17589cf6ep+8L : inexact-ok += log1p downward ldbl-128ibm 0x1p+1000L : 0x2.b525ada00b9273470ca17589cfp+8L : inexact-ok += log1p tonearest ldbl-128ibm 0x1p+1000L : 0x2.b525ada00b9273470ca17589cfp+8L : inexact-ok += log1p towardzero ldbl-128ibm 0x1p+1000L : 0x2.b525ada00b9273470ca17589cfp+8L : inexact-ok += log1p upward ldbl-128ibm 0x1p+1000L : 0x2.b525ada00b9273470ca17589dp+8L : inexact-ok +log1p max += log1p downward flt-32 0xf.fffffp+124f : 0x5.8b90b8p+4f : inexact-ok += log1p tonearest flt-32 0xf.fffffp+124f : 0x5.8b90cp+4f : inexact-ok += log1p towardzero flt-32 0xf.fffffp+124f : 0x5.8b90b8p+4f : inexact-ok += log1p upward flt-32 0xf.fffffp+124f : 0x5.8b90cp+4f : inexact-ok += log1p downward dbl-64 0xf.fffffp+124 : 0x5.8b90bfae8e7bcp+4 : inexact-ok += log1p tonearest dbl-64 0xf.fffffp+124 : 0x5.8b90bfae8e7bcp+4 : inexact-ok += log1p towardzero dbl-64 0xf.fffffp+124 : 0x5.8b90bfae8e7bcp+4 : inexact-ok += log1p upward dbl-64 0xf.fffffp+124 : 0x5.8b90bfae8e7cp+4 : inexact-ok += log1p downward ldbl-96-intel 0xf.fffffp+124L : 0x5.8b90bfae8e7bc558p+4L : inexact-ok += log1p tonearest ldbl-96-intel 0xf.fffffp+124L : 0x5.8b90bfae8e7bc56p+4L : inexact-ok += log1p towardzero ldbl-96-intel 0xf.fffffp+124L : 0x5.8b90bfae8e7bc558p+4L : inexact-ok += log1p upward ldbl-96-intel 0xf.fffffp+124L : 0x5.8b90bfae8e7bc56p+4L : inexact-ok += log1p downward ldbl-96-m68k 0xf.fffffp+124L : 0x5.8b90bfae8e7bc558p+4L : inexact-ok += log1p tonearest ldbl-96-m68k 0xf.fffffp+124L : 0x5.8b90bfae8e7bc56p+4L : inexact-ok += log1p towardzero ldbl-96-m68k 0xf.fffffp+124L : 0x5.8b90bfae8e7bc558p+4L : inexact-ok += log1p upward ldbl-96-m68k 0xf.fffffp+124L : 0x5.8b90bfae8e7bc56p+4L : inexact-ok += log1p downward ldbl-128 0xf.fffffp+124L : 0x5.8b90bfae8e7bc55e4f18476ac64p+4L : inexact-ok += log1p tonearest ldbl-128 0xf.fffffp+124L : 0x5.8b90bfae8e7bc55e4f18476ac644p+4L : inexact-ok += log1p towardzero ldbl-128 0xf.fffffp+124L : 0x5.8b90bfae8e7bc55e4f18476ac64p+4L : inexact-ok += log1p upward ldbl-128 0xf.fffffp+124L : 0x5.8b90bfae8e7bc55e4f18476ac644p+4L : inexact-ok += log1p downward ldbl-128ibm 0xf.fffffp+124L : 0x5.8b90bfae8e7bc55e4f18476ac6p+4L : inexact-ok += log1p tonearest ldbl-128ibm 0xf.fffffp+124L : 0x5.8b90bfae8e7bc55e4f18476ac6p+4L : inexact-ok += log1p towardzero ldbl-128ibm 0xf.fffffp+124L : 0x5.8b90bfae8e7bc55e4f18476ac6p+4L : inexact-ok += log1p upward ldbl-128ibm 0xf.fffffp+124L : 0x5.8b90bfae8e7bc55e4f18476ac8p+4L : inexact-ok += log1p downward dbl-64 0xf.ffffffffffff8p+1020 : 0x2.c5c85fdf473dep+8 : inexact-ok += log1p tonearest dbl-64 0xf.ffffffffffff8p+1020 : 0x2.c5c85fdf473dep+8 : inexact-ok += log1p towardzero dbl-64 0xf.ffffffffffff8p+1020 : 0x2.c5c85fdf473dep+8 : inexact-ok += log1p upward dbl-64 0xf.ffffffffffff8p+1020 : 0x2.c5c85fdf473ep+8 : inexact-ok += log1p downward ldbl-96-intel 0xf.ffffffffffff8p+1020L : 0x2.c5c85fdf473de6a4p+8L : inexact-ok += log1p tonearest ldbl-96-intel 0xf.ffffffffffff8p+1020L : 0x2.c5c85fdf473de6a8p+8L : inexact-ok += log1p towardzero ldbl-96-intel 0xf.ffffffffffff8p+1020L : 0x2.c5c85fdf473de6a4p+8L : inexact-ok += log1p upward ldbl-96-intel 0xf.ffffffffffff8p+1020L : 0x2.c5c85fdf473de6a8p+8L : inexact-ok += log1p downward ldbl-96-m68k 0xf.ffffffffffff8p+1020L : 0x2.c5c85fdf473de6a4p+8L : inexact-ok += log1p tonearest ldbl-96-m68k 0xf.ffffffffffff8p+1020L : 0x2.c5c85fdf473de6a8p+8L : inexact-ok += log1p towardzero ldbl-96-m68k 0xf.ffffffffffff8p+1020L : 0x2.c5c85fdf473de6a4p+8L : inexact-ok += log1p upward ldbl-96-m68k 0xf.ffffffffffff8p+1020L : 0x2.c5c85fdf473de6a8p+8L : inexact-ok += log1p downward ldbl-128 0xf.ffffffffffff8p+1020L : 0x2.c5c85fdf473de6a7278ece600fcap+8L : inexact-ok += log1p tonearest ldbl-128 0xf.ffffffffffff8p+1020L : 0x2.c5c85fdf473de6a7278ece600fccp+8L : inexact-ok += log1p towardzero ldbl-128 0xf.ffffffffffff8p+1020L : 0x2.c5c85fdf473de6a7278ece600fcap+8L : inexact-ok += log1p upward ldbl-128 0xf.ffffffffffff8p+1020L : 0x2.c5c85fdf473de6a7278ece600fccp+8L : inexact-ok += log1p downward ldbl-128ibm 0xf.ffffffffffff8p+1020L : 0x2.c5c85fdf473de6a7278ece600fp+8L : inexact-ok += log1p tonearest ldbl-128ibm 0xf.ffffffffffff8p+1020L : 0x2.c5c85fdf473de6a7278ece601p+8L : inexact-ok += log1p towardzero ldbl-128ibm 0xf.ffffffffffff8p+1020L : 0x2.c5c85fdf473de6a7278ece600fp+8L : inexact-ok += log1p upward ldbl-128ibm 0xf.ffffffffffff8p+1020L : 0x2.c5c85fdf473de6a7278ece601p+8L : inexact-ok += log1p downward ldbl-96-intel 0xf.fffffffffffffffp+16380L : 0x2.c5c85fdf473de6acp+12L : inexact-ok += log1p tonearest ldbl-96-intel 0xf.fffffffffffffffp+16380L : 0x2.c5c85fdf473de6bp+12L : inexact-ok += log1p towardzero ldbl-96-intel 0xf.fffffffffffffffp+16380L : 0x2.c5c85fdf473de6acp+12L : inexact-ok += log1p upward ldbl-96-intel 0xf.fffffffffffffffp+16380L : 0x2.c5c85fdf473de6bp+12L : inexact-ok += log1p downward ldbl-96-m68k 0xf.fffffffffffffffp+16380L : 0x2.c5c85fdf473de6acp+12L : inexact-ok += log1p tonearest ldbl-96-m68k 0xf.fffffffffffffffp+16380L : 0x2.c5c85fdf473de6bp+12L : inexact-ok += log1p towardzero ldbl-96-m68k 0xf.fffffffffffffffp+16380L : 0x2.c5c85fdf473de6acp+12L : inexact-ok += log1p upward ldbl-96-m68k 0xf.fffffffffffffffp+16380L : 0x2.c5c85fdf473de6bp+12L : inexact-ok += log1p downward ldbl-128 0xf.fffffffffffffffp+16380L : 0x2.c5c85fdf473de6af277ece600fcap+12L : inexact-ok += log1p tonearest ldbl-128 0xf.fffffffffffffffp+16380L : 0x2.c5c85fdf473de6af277ece600fccp+12L : inexact-ok += log1p towardzero ldbl-128 0xf.fffffffffffffffp+16380L : 0x2.c5c85fdf473de6af277ece600fcap+12L : inexact-ok += log1p upward ldbl-128 0xf.fffffffffffffffp+16380L : 0x2.c5c85fdf473de6af277ece600fccp+12L : inexact-ok += log1p downward ldbl-128 0xf.fffffffffffffffffffffffffff8p+16380L : 0x2.c5c85fdf473de6af278ece600fcap+12L : inexact-ok += log1p tonearest ldbl-128 0xf.fffffffffffffffffffffffffff8p+16380L : 0x2.c5c85fdf473de6af278ece600fccp+12L : inexact-ok += log1p towardzero ldbl-128 0xf.fffffffffffffffffffffffffff8p+16380L : 0x2.c5c85fdf473de6af278ece600fcap+12L : inexact-ok += log1p upward ldbl-128 0xf.fffffffffffffffffffffffffff8p+16380L : 0x2.c5c85fdf473de6af278ece600fccp+12L : inexact-ok += log1p downward ldbl-128 0xf.ffffffffffffbffffffffffffcp+1020L : 0x2.c5c85fdf473de6ab278ece600fcap+8L : inexact-ok += log1p tonearest ldbl-128 0xf.ffffffffffffbffffffffffffcp+1020L : 0x2.c5c85fdf473de6ab278ece600fccp+8L : inexact-ok += log1p towardzero ldbl-128 0xf.ffffffffffffbffffffffffffcp+1020L : 0x2.c5c85fdf473de6ab278ece600fcap+8L : inexact-ok += log1p upward ldbl-128 0xf.ffffffffffffbffffffffffffcp+1020L : 0x2.c5c85fdf473de6ab278ece600fccp+8L : inexact-ok += log1p downward ldbl-128ibm 0xf.ffffffffffffbffffffffffffcp+1020L : 0x2.c5c85fdf473de6ab278ece600fp+8L : inexact-ok += log1p tonearest ldbl-128ibm 0xf.ffffffffffffbffffffffffffcp+1020L : 0x2.c5c85fdf473de6ab278ece601p+8L : inexact-ok += log1p towardzero ldbl-128ibm 0xf.ffffffffffffbffffffffffffcp+1020L : 0x2.c5c85fdf473de6ab278ece600fp+8L : inexact-ok += log1p upward ldbl-128ibm 0xf.ffffffffffffbffffffffffffcp+1020L : 0x2.c5c85fdf473de6ab278ece601p+8L : inexact-ok log2 1 = log2 downward flt-32 0x1p+0f : 0x0p+0f : inexact-ok = log2 tonearest flt-32 0x1p+0f : 0x0p+0f : inexact-ok diff --git a/sysdeps/i386/fpu/s_log1pl.S b/sysdeps/i386/fpu/s_log1pl.S index 93c07b637c..d2d5d3bc7c 100644 --- a/sysdeps/i386/fpu/s_log1pl.S +++ b/sysdeps/i386/fpu/s_log1pl.S @@ -53,12 +53,17 @@ ENTRY(__log1pl) sahf jnc 2f + movzwl 4+8(%esp), %eax + xorb $0x80, %ah + cmpl $0xc040, %eax + jae 5f + #ifdef PIC faddl one@GOTOFF(%edx) #else faddl one #endif - fyl2x +5: fyl2x ret 2: fyl2xp1 diff --git a/sysdeps/ieee754/ldbl-128/s_log1pl.c b/sysdeps/ieee754/ldbl-128/s_log1pl.c index d8d89f0a8c..4a30af62fa 100644 --- a/sysdeps/ieee754/ldbl-128/s_log1pl.c +++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c @@ -144,7 +144,10 @@ __log1pl (long double xm1) return xm1; } - x = xm1 + 1.0L; + if (xm1 >= 0x1p113L) + x = xm1; + else + x = xm1 + 1.0L; /* log1p(-1) = -inf */ if (x <= 0.0L) diff --git a/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c b/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c index a346383052..e4bb6e8d9b 100644 --- a/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c +++ b/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c @@ -140,7 +140,10 @@ __log1pl (long double xm1) if (((hx & 0x7fffffff) | lx) == 0) return xm1; - x = xm1 + 1.0L; + if (xm1 >= 0x1p107L) + x = xm1; + else + x = xm1 + 1.0L; /* log1p(-1) = -inf */ if (x <= 0.0L) diff --git a/sysdeps/x86_64/fpu/s_log1pl.S b/sysdeps/x86_64/fpu/s_log1pl.S index b4dbcdfa1a..af3024ad55 100644 --- a/sysdeps/x86_64/fpu/s_log1pl.S +++ b/sysdeps/x86_64/fpu/s_log1pl.S @@ -52,8 +52,13 @@ ENTRY(__log1pl) andb $1,%ah jz 2f + movzwl 8+8(%rsp), %eax + xorb $0x80, %ah + cmpl $0xc040, %eax + jae 5f + faddl MO(one) - fyl2x +5: fyl2x ret 2: fyl2xp1 -- 2.43.5