/* Complex cosine hyperbole function for double.
- Copyright (C) 1997-2012 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) ((DBL_MAX_EXP - 1) * M_LN2);
double sinix, cosix;
- __sincos (__imag__ x, &sinix, &cosix);
+ if (__glibc_likely (fabs (__imag__ x) > DBL_MIN))
+ {
+ __sincos (__imag__ x, &sinix, &cosix);
+ }
+ else
+ {
+ sinix = __imag__ x;
+ cosix = 1.0;
+ }
if (fabs (__real__ x) > t)
{
__real__ retval = __ieee754_cosh (__real__ x) * cosix;
__imag__ retval = __ieee754_sinh (__real__ x) * sinix;
}
+
+ math_check_force_underflow_complex (retval);
}
else
{
else if (rcls == FP_INFINITE)
{
/* Real part is infinite. */
- if (__builtin_expect (icls > FP_ZERO, 1))
+ if (__glibc_likely (icls > FP_ZERO))
{
/* Imaginary part is finite. */
double sinix, cosix;
- __sincos (__imag__ x, &sinix, &cosix);
+ if (__glibc_likely (fabs (__imag__ x) > DBL_MIN))
+ {
+ __sincos (__imag__ x, &sinix, &cosix);
+ }
+ else
+ {
+ sinix = __imag__ x;
+ cosix = 1.0;
+ }
__real__ retval = __copysign (HUGE_VAL, cosix);
__imag__ retval = (__copysign (HUGE_VAL, sinix)