diff options
author | Szabolcs Nagy <nsz@port70.net> | 2012-11-13 01:31:49 +0100 |
---|---|---|
committer | Szabolcs Nagy <nsz@port70.net> | 2012-11-13 01:31:49 +0100 |
commit | cfbaba79a2dd380e580a247b8fd36af60c878e8f (patch) | |
tree | a002987af1ea7652985973f8db98d2d4f8b6064a /src/complex/csinh.c | |
parent | e2fe959fe2a450f74271d4d3c4b0d9456f889125 (diff) | |
download | musl-cfbaba79a2dd380e580a247b8fd36af60c878e8f.tar.gz |
complex: add C11 CMPLX macros and replace cpack with them
Diffstat (limited to 'src/complex/csinh.c')
-rw-r--r-- | src/complex/csinh.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/complex/csinh.c b/src/complex/csinh.c index fe16f06b..0f8035d1 100644 --- a/src/complex/csinh.c +++ b/src/complex/csinh.c @@ -55,23 +55,23 @@ double complex csinh(double complex z) /* Handle the nearly-non-exceptional cases where x and y are finite. */ if (ix < 0x7ff00000 && iy < 0x7ff00000) { if ((iy | ly) == 0) - return cpack(sinh(x), y); + return CMPLX(sinh(x), y); if (ix < 0x40360000) /* small x: normal case */ - return cpack(sinh(x) * cos(y), cosh(x) * sin(y)); + return CMPLX(sinh(x) * cos(y), cosh(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(copysign(h, x) * cos(y), h * sin(y)); + return CMPLX(copysign(h, x) * cos(y), h * sin(y)); } else if (ix < 0x4096bbaa) { /* x < 1455: scale to avoid overflow */ - z = __ldexp_cexp(cpack(fabs(x), y), -1); - return cpack(creal(z) * copysign(1, x), cimag(z)); + z = __ldexp_cexp(CMPLX(fabs(x), y), -1); + return CMPLX(creal(z) * copysign(1, x), cimag(z)); } else { /* x >= 1455: the result always overflows */ h = huge * x; - return cpack(h * cos(y), h * h * sin(y)); + return CMPLX(h * cos(y), h * h * sin(y)); } } @@ -85,7 +85,7 @@ double complex csinh(double complex z) * the same as d(NaN). */ if ((ix | lx) == 0 && iy >= 0x7ff00000) - return cpack(copysign(0, x * (y - y)), y - y); + return CMPLX(copysign(0, x * (y - y)), y - y); /* * sinh(+-Inf +- I 0) = +-Inf + I +-0. @@ -94,8 +94,8 @@ double complex csinh(double complex z) */ if ((iy | ly) == 0 && ix >= 0x7ff00000) { if (((hx & 0xfffff) | lx) == 0) - return cpack(x, y); - return cpack(x, copysign(0, y)); + return CMPLX(x, y); + return CMPLX(x, copysign(0, y)); } /* @@ -107,7 +107,7 @@ double complex csinh(double complex z) * 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)); /* * sinh(+-Inf + I NaN) = +-Inf + I d(NaN). @@ -122,8 +122,8 @@ double complex csinh(double complex z) */ if (ix >= 0x7ff00000 && ((hx & 0xfffff) | lx) == 0) { if (iy >= 0x7ff00000) - return cpack(x * x, x * (y - y)); - return cpack(x * cos(y), INFINITY * sin(y)); + return CMPLX(x * x, x * (y - y)); + return CMPLX(x * cos(y), INFINITY * sin(y)); } /* @@ -137,5 +137,5 @@ double complex csinh(double complex z) * 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)); } |