/* Handle the nearly-non-exceptional cases where x and y are finite. */
if (ix < 0x7ff00000 && iy < 0x7ff00000) {
if ((iy | ly) == 0)
- return cpack(cosh(x), x * y);
+ return CMPLX(cosh(x), x * y);
if (ix < 0x40360000) /* small x: normal case */
- return cpack(cosh(x) * cos(y), sinh(x) * sin(y));
+ return CMPLX(cosh(x) * cos(y), sinh(x) * sin(y));
/* |x| >= 22, so cosh(x) ~= exp(|x|) */
if (ix < 0x40862e42) {
/* x < 710: exp(|x|) won't overflow */
h = exp(fabs(x)) * 0.5;
- return cpack(h * cos(y), copysign(h, x) * sin(y));
+ return CMPLX(h * cos(y), copysign(h, x) * sin(y));
} else if (ix < 0x4096bbaa) {
/* x < 1455: scale to avoid overflow */
- z = __ldexp_cexp(cpack(fabs(x), y), -1);
- return cpack(creal(z), cimag(z) * copysign(1, x));
+ z = __ldexp_cexp(CMPLX(fabs(x), y), -1);
+ return CMPLX(creal(z), cimag(z) * copysign(1, x));
} else {
/* x >= 1455: the result always overflows */
h = huge * x;
- return cpack(h * h * cos(y), h * sin(y));
+ return CMPLX(h * h * cos(y), h * sin(y));
}
}
* the same as d(NaN).
*/
if ((ix | lx) == 0 && iy >= 0x7ff00000)
- return cpack(y - y, copysign(0, x * (y - y)));
+ return CMPLX(y - y, copysign(0, x * (y - y)));
/*
* cosh(+-Inf +- I 0) = +Inf + I (+-)(+-)0.
*/
if ((iy | ly) == 0 && ix >= 0x7ff00000) {
if (((hx & 0xfffff) | lx) == 0)
- return cpack(x * x, copysign(0, x) * y);
- return cpack(x * x, copysign(0, (x + x) * y));
+ return CMPLX(x * x, copysign(0, x) * y);
+ return CMPLX(x * x, copysign(0, (x + x) * y));
}
/*
* nonzero x. Choice = don't raise (except for signaling NaNs).
*/
if (ix < 0x7ff00000 && iy >= 0x7ff00000)
- return cpack(y - y, x * (y - y));
+ return CMPLX(y - y, x * (y - y));
/*
* cosh(+-Inf + I NaN) = +Inf + I d(NaN).
*/
if (ix >= 0x7ff00000 && ((hx & 0xfffff) | lx) == 0) {
if (iy >= 0x7ff00000)
- return cpack(x * x, x * (y - y));
- return cpack((x * x) * cos(y), x * sin(y));
+ return CMPLX(x * x, x * (y - y));
+ return CMPLX((x * x) * cos(y), x * sin(y));
}
/*
* Optionally raises the invalid floating-point exception for finite
* nonzero y. Choice = don't raise (except for signaling NaNs).
*/
- return cpack((x * x) * (y - y), (x + x) * (y - y));
+ return CMPLX((x * x) * (y - y), (x + x) * (y - y));
}