/* Return value of complex exponential function for long double complex value.
- Copyright (C) 1997-2013 Free Software Foundation, Inc.
+ Copyright (C) 1997-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (__builtin_expect (rcls >= FP_ZERO, 1))
+ if (__glibc_likely (rcls >= FP_ZERO))
{
/* Real part is finite. */
- if (__builtin_expect (icls >= FP_ZERO, 1))
+ if (__glibc_likely (icls >= FP_ZERO))
{
/* Imaginary part is finite. */
const int t = (int) ((LDBL_MAX_EXP - 1) * M_LN2l);
long double sinix, cosix;
- if (__builtin_expect (icls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (fabsl (__imag__ x) > LDBL_MIN))
{
__sincosl (__imag__ x, &sinix, &cosix);
}
__real__ retval = exp_val * cosix;
__imag__ retval = exp_val * sinix;
}
- if (fabsl (__real__ retval) < LDBL_MIN)
- {
- volatile long double force_underflow
- = __real__ retval * __real__ retval;
- (void) force_underflow;
- }
- if (fabsl (__imag__ retval) < LDBL_MIN)
- {
- volatile long double force_underflow
- = __imag__ retval * __imag__ retval;
- (void) force_underflow;
- }
+ math_check_force_underflow_complex (retval);
}
else
{
feraiseexcept (FE_INVALID);
}
}
- else if (__builtin_expect (rcls == FP_INFINITE, 1))
+ else if (__glibc_likely (rcls == FP_INFINITE))
{
/* Real part is infinite. */
- if (__builtin_expect (icls >= FP_ZERO, 1))
+ if (__glibc_likely (icls >= FP_ZERO))
{
/* Imaginary part is finite. */
long double value = signbit (__real__ x) ? 0.0 : HUGE_VALL;
{
long double sinix, cosix;
- if (__builtin_expect (icls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (fabsl (__imag__ x) > LDBL_MIN))
{
__sincosl (__imag__ x, &sinix, &cosix);
}
}
else
{
- /* If the real part is NaN the result is NaN + iNaN. */
+ /* If the real part is NaN the result is NaN + iNaN unless the
+ imaginary part is zero. */
__real__ retval = __nanl ("");
- __imag__ retval = __nanl ("");
+ if (icls == FP_ZERO)
+ __imag__ retval = __imag__ x;
+ else
+ {
+ __imag__ retval = __nanl ("");
- if (rcls != FP_NAN || icls != FP_NAN)
- feraiseexcept (FE_INVALID);
+ if (rcls != FP_NAN || icls != FP_NAN)
+ feraiseexcept (FE_INVALID);
+ }
}
return retval;