glibc/sysdeps/ieee754/ldbl-128ibm/w_expl.c
Joseph Myers 6c9678ebd4 Fix ldbl-128ibm expl overflow in non-default rounding modes (bug 19078).
The ldbl-128ibm expl wrapper checks the argument to determine when to
call __kernel_standard_l, thereby overriding overflowing results from
__ieee754_expl that could otherwise (given appropriately patched
libgcc) be correct for the rounding mode.  This patch changes it to
check the result of __ieee754_expl instead, as other versions of this
wrapper do.

Tested for powerpc.

	[BZ #19078]
	* sysdeps/ieee754/ldbl-128ibm/w_expl.c (o_thres): Remove variable.
	(u_thres): Likewise.
	(__expl): Determine whether to call __kernel_standard_l based on
	value of result, not argument.
2015-10-06 17:37:49 +00:00

22 lines
487 B
C

#include <math.h>
#include <math_private.h>
#include <math_ldbl_opt.h>
long double __expl(long double x) /* wrapper exp */
{
long double z;
z = __ieee754_expl(x);
if (_LIB_VERSION == _IEEE_)
return z;
if (isfinite(x))
{
if (!isfinite (z))
return __kernel_standard_l(x,x,206); /* exp overflow */
else if (z == 0.0L)
return __kernel_standard_l(x,x,207); /* exp underflow */
}
return z;
}
hidden_def (__expl)
long_double_symbol (libm, __expl, expl);