aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/dbl-64
AgeCommit message (Collapse)Author
2014-05-14Fix erf underflow handling near 0 (bug 16516).Joseph Myers
Bug 16516 reports spurious underflows from erf (for all floating-point types), when the result is close to underflowing but does not actually underflow. erf (x) is about (2/sqrt(pi))*x for x close to 0, so there are subnormal arguments for which it does not underflow. The various implementations do (x + efx*x) (for efx = 2/sqrt(pi) - 1), for greater accuracy than if just using a single multiplication by an approximation to 2/sqrt(pi) (effectively, this way there are a few more bits in the approximation to 2/sqrt(pi)). This can introduce underflows when efx*x underflows even though the final result does not, so a scaled calculation with 8*efx is done in these cases - but 8 is not a big enough scale factor to avoid all such underflows. 16 is (any underflows with a scale factor of 16 would only occur when the final result underflows), so this patch changes the code to use that factor. Rather than recomputing all the values of the efx8 variable, it is removed, leaving it to the compiler's constant folding to compute 16*efx. As such scaling can also lose underflows when the final scaling down happens to be exact, appropriate checks are added to ensure underflow exceptions occur when required in such cases. Tested x86_64 and x86; no ulps updates needed. Also spot-checked for powerpc32 and mips64 to verify the changes to the ldbl-128ibm and ldbl-128 implementations. [BZ #16516] * sysdeps/ieee754/dbl-64/s_erf.c (efx8): Remove variable. (__erf): Scale by 16 instead of 8 in potentially underflowing case. Ensure exception if result actually underflows. * sysdeps/ieee754/flt-32/s_erff.c (efx8): Remove variable. (__erff): Scale by 16 instead of 8 in potentially underflowing case. Ensure exception if result actually underflows. * sysdeps/ieee754/ldbl-128/s_erfl.c: Include <float.h>. (efx8): Remove variable. (__erfl): Scale by 16 instead of 8 in potentially underflowing case. Ensure exception if result actually underflows. * sysdeps/ieee754/ldbl-128ibm/s_erfl.c: Include <float.h>. (efx8): Remove variable. (__erfl): Scale by 16 instead of 8 in potentially underflowing case. Ensure exception if result actually underflows. * sysdeps/ieee754/ldbl-96/s_erfl.c: Include <float.h>. (efx8): Remove variable. (__erfl): Scale by 16 instead of 8 in potentially underflowing case. Ensure exception if result actually underflows. * math/auto-libm-test-in: Add more tests of erf. * math/auto-libm-test-out: Regenerated.
2014-04-29[BZ #16823] Fix log1pl returning wrong infinity signStefan Liebler
2014-03-24Fix implicit __isinf declarations in exp.Joseph Myers
My recent exp patch introduced warnings about implicit __isinf declarations in exp because e_exp.c didn't include <math.h>. This patch fixes this. Because <math.h> can't be included after <math_private.h> (because of macro definitions of __nan*), it was necessary to put an include in sysdeps/x86_64/fpu/multiarch/e_exp.c as well. Tested x86_64. * sysdeps/ieee754/dbl-64/e_exp.c: Include <math.h>. * sysdeps/x86_64/fpu/multiarch/e_exp.c [HAVE_FMA4_SUPPORT || HAVE_AVX_SUPPORT]: Likewise.
2014-03-24Fix dbl-64 exp overflow/underflow in non-default rounding modes (bug 16284).Joseph Myers
The dbl-64 version of exp needs round-to-nearest mode for its internal computations, but that has the consequence of inappropriate overflowing and underflowing results in other rounding modes. This patch fixes this by recomputing the relevant results in cases where the round-to-nearest result overflows to infinity or underflows to zero (most of the diffs are actually just consequent reindentation). Tests are enabled in all rounding modes for complex functions using exp - but not for cexp because it turns out there are bugs causing spurious underflows for cexp for some tests, which will need to be fixed separately (I suspect ccos ccosh csin csinh ctan ctanh have similar bugs, just not shown by the present set of test inputs). Tested x86_64 and x86 and ulps updated accordingly. [BZ #16284] * sysdeps/ieee754/dbl-64/e_exp.c (__ieee754_exp): Use original rounding mode to recompute results that overflow to infinity or underflow to zero. * math/auto-libm-test-in: Don't mark tests as expected to fail for bug 16284. * math/auto-libm-test-out: Regenerated. * math/libm-test.inc (ccos_test): Use ALL_RM_TEST. (ccosh_test): Likewise. (csin_test_data): Use plus_oflow. (csin_test): Use ALL_RM_TEST. (csinh_test_data): Use plus_oflow. (csinh_test): Use ALL_RM_TEST. * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2014-03-21Fix log (1) in round-downward mode (bug 16731).Joseph Myers
According to ISO C Annex F, log (1) should be +0 in all rounding modes, but some implementations in glibc wrongly return -0 in round-downward mode (mapping to log1p (x - 1) is problematic because 1 - 1 is -0 in round-downward mode, and log1p (-0) is -0). This patch fixes this. (It helps with some implementations of other functions such as acosh, log2 and log10 that call out to log, but not enough to enable all-rounding-modes testing for those functions without further fixes to other implementations of them.) Tested x86_64 and x86 and ulps updated accordingly, and did spot tests for mips64 for the ldbl-128 fix, and i586 for the sysdeps/i386/fpu implementations shadowed by those in sysdeps/i386/i686/fpu. [BZ #16731] * sysdeps/i386/fpu/e_log.S (__ieee754_log): Take absolute value when x - 1 is zero. * sysdeps/i386/fpu/e_logf.S (__ieee754_logf): Likewise. * sysdeps/i386/fpu/e_logl.S (__ieee754_logl): Likewise. * sysdeps/i386/i686/fpu/e_logl.S (__ieee754_logl): Likewise. * sysdeps/ieee754/dbl-64/e_log.c (__ieee754_log): Return +0 when argument is 1. * sysdeps/ieee754/ldbl-128/e_logl.c (__ieee754_logl): Likewise. * sysdeps/x86_64/fpu/e_logl.S: Take absolute value when x - 1 is zero. * math/libm-test.inc (log_test): Use ALL_RM_TEST. * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2014-02-27Fix sign of input to bsloww1 (BZ #16623)Siddhesh Poyarekar
In 84ba214c, I removed some redundant sign computations and in the process, I incorrectly got rid of a temporary variable, thus passing the absolute value of the input to bsloww1. This caused #16623. This fix undoes the incorrect change.
2014-02-10Use glibc_likely instead __builtin_expect.Ondřej Bílka
2014-01-01Update copyright notices with scripts/update-copyrightsAllan McRae
2013-12-27Fix typo in csloww()Allan McRae
An incorrect variable name was used during the refactoring done in commit 4aafb73c.
2013-12-20Consolidate code to compute sin and cos from lookup tablesSiddhesh Poyarekar
This patch consolidates the multiple copies of code that looks up sin and cos of a number from the lookup table and computes the final value, into static functions. This does not have a noticeable performance impact since the functions are inlined by gcc. There is further scope for consolidation in the functions but they cause a more noticable impact on performance (>5%) due to which I have held back on them.
2013-12-20Remove more redundant computations in s_sin.cSiddhesh Poyarekar
Removed more redundant computations in the slow paths of the sin and cos functions. The notable change is the passing of the most significant bits of X to the slow functions to check if X is positive so that just the absolute value of x can be passed and the repeated ABS() operation is avoided.
2013-12-20Remove redundant arguments in reduce_and_computeSiddhesh Poyarekar
The A and DA arguments in reduce_and_compute are useless and hence have been removed.
2013-12-20Remove some redundant computations in s_sin.cSiddhesh Poyarekar
There are multiple points in the code where the absolute value of a number is computed multiple times or is computed even though the value can only be positive. This change removes those redundant computations. Tested on x86_64 to verify that there were no regressions in the testsuite.
2013-12-18Compile e_sqrt.c with -ffp-contract=off.Marcus Shawcroft
2013-12-17Fix dbl-64 hypot spurious underflows (bug 16314).Joseph Myers
2013-12-17Fix hypot handling of subnormals (bug 16316, bug 16330).Joseph Myers
2013-12-16Minor code cleanup in s_sin.cSiddhesh Poyarekar
- Remove redundant mynumber union definitions - Clean up a clumsy ternary operator - Rename TAYLOR_SINCOS to TAYLOR_SIN since we're only expanding the sin Taylor series in it.
2013-12-11Consolidate definition of constant t22Siddhesh Poyarekar
2013-12-11Use double constants instead of the struct numberSiddhesh Poyarekar
2013-12-06PowerPC: multiarch finite/finitef for PowerPC32Adhemerval Zanella
2013-12-03Fix exp missing underflows (bug 15268, bug 15425).Joseph Myers
2013-12-03Fix erfc errno setting on underflow (bug 6786).Joseph Myers
2013-11-28Fix dbl-64 e_sqrt.c for non-default rounding modes (bug 16271).Joseph Myers
2013-11-20Add systemtap probe markers for sin, cos, asin and acosSiddhesh Poyarekar
2013-10-28Consolidate conditionals in mp sin/cos functionsSiddhesh Poyarekar
Consolidate conditionals in multiple precision sin and cos functions to prepare the code for addition of probe points.
2013-10-17Format floating routines.Ondřej Bílka
2013-10-11Add systemtap markers to math function slow pathsSiddhesh Poyarekar
Add systemtap probes to various slow paths in libm so that application developers may use systemtap to find out if their applications are hitting these slow paths. We have added probes for pow, exp, log, tan, atan and atan2.
2013-10-08Format e_pow.cSiddhesh Poyarekar
2013-10-08Format e_exp.cSiddhesh Poyarekar
2013-10-08Consolidate multiple precision sin/cos functionsSiddhesh Poyarekar
2013-09-19Consolidate common code into macrosSiddhesh Poyarekar
Consolidated common Taylor series polynomials into macros in s_sin.c to make it a bit cleaner.
2013-09-19Consolidate sin/cos table lookup codeSiddhesh Poyarekar
2013-09-19Consolidate sin/cos computation for large inputsSiddhesh Poyarekar
2013-09-19Remove redundant goto linesSiddhesh Poyarekar
2013-09-18Format sincos32.cSiddhesh Poyarekar
2013-09-10Remove DO_NOT_USE_THIS conditionals.Ondřej Bílka
2013-06-15Fix spurious "inexact" exceptions from dbl-64 sqrt (bug 15631).Joseph Myers
2013-06-06Fix leading whitespaces.Ondrej Bilka
2013-06-05Remove trailing whitespace.Joseph Myers
2013-05-19Fix nearbyint scheduling of arithmetic past fesetenv (bug 15490).Joseph Myers
2013-05-17Fix remainder exceptions and directed-rounding results (bugs 15480, 15485).Joseph Myers
2013-05-16Add #include <stdint.h> for uint[32|64]_t usage (except installed headers).Ryan S. Arnold
2013-05-08Improve tgamma accuracy (bugs 2546, 2560, 5159, 15426).Joseph Myers
2013-04-30Format s_sin.cSiddhesh Poyarekar
2013-04-05[BZ #14686, #15336] Fix standard compliance. Don't use hard-coded qNaN values.Thomas Schwinge
2013-04-05[BZ #15335, #15342] Fix standard compliance. Don't use hard-coded qNaN values.Thomas Schwinge
2013-04-05Remove unreachable code.Thomas Schwinge
The case of y == 0 is handled at the beginning of the function.
2013-04-05Remove unused hard-coded qNaN definition.Thomas Schwinge
2013-04-03Remove TWOSiddhesh Poyarekar
Minor cleanup to remove the macro TWO and use the value directly instead.
2013-04-02Use mantissa_t in mpexpSiddhesh Poyarekar