diff options
author | Ed Schouten <ed@FreeBSD.org> | 2014-12-16 09:21:56 +0000 |
---|---|---|
committer | Ed Schouten <ed@FreeBSD.org> | 2014-12-16 09:21:56 +0000 |
commit | 2cec876a59a7c5396e3df7e21e82091cd461a94a (patch) | |
tree | f49cd325cda312901e36575562909270bd0b2525 /lib/msun/src/s_cexpf.c | |
parent | c7d73a4d23fe6884a49b0a4eb8734aa8a153bef4 (diff) | |
download | src-2cec876a59a7c5396e3df7e21e82091cd461a94a.tar.gz src-2cec876a59a7c5396e3df7e21e82091cd461a94a.zip |
Rename cpack*() to CMPLX*().
The C11 standard introduced a set of macros (CMPLX, CMPLXF, CMPLXL) that
can be used to construct complex numbers from a pair of real and
imaginary numbers. Unfortunately, they require some compiler support,
which is why we only define them for Clang and GCC>=4.7.
The cpack() function in libm performs the same task as CMPLX(), but
cannot be used to generate compile-time constants. This means that all
invocations of cpack() can safely be replaced by C11's CMPLX(). To keep
the code building with GCC 4.2, provide copies of CMPLX() that can at
least be used to generate run-time complex numbers.
This makes it easier to build some of the functions outside of libm.
Notes
Notes:
svn path=/head/; revision=275819
Diffstat (limited to 'lib/msun/src/s_cexpf.c')
-rw-r--r-- | lib/msun/src/s_cexpf.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/msun/src/s_cexpf.c b/lib/msun/src/s_cexpf.c index 0e30d08c80db..0138cd1e83fb 100644 --- a/lib/msun/src/s_cexpf.c +++ b/lib/msun/src/s_cexpf.c @@ -50,22 +50,22 @@ cexpf(float complex z) /* cexp(x + I 0) = exp(x) + I 0 */ if (hy == 0) - return (cpackf(expf(x), y)); + return (CMPLXF(expf(x), y)); GET_FLOAT_WORD(hx, x); /* cexp(0 + I y) = cos(y) + I sin(y) */ if ((hx & 0x7fffffff) == 0) - return (cpackf(cosf(y), sinf(y))); + return (CMPLXF(cosf(y), sinf(y))); if (hy >= 0x7f800000) { if ((hx & 0x7fffffff) != 0x7f800000) { /* cexp(finite|NaN +- I Inf|NaN) = NaN + I NaN */ - return (cpackf(y - y, y - y)); + return (CMPLXF(y - y, y - y)); } else if (hx & 0x80000000) { /* cexp(-Inf +- I Inf|NaN) = 0 + I 0 */ - return (cpackf(0.0, 0.0)); + return (CMPLXF(0.0, 0.0)); } else { /* cexp(+Inf +- I Inf|NaN) = Inf + I NaN */ - return (cpackf(x, y - y)); + return (CMPLXF(x, y - y)); } } @@ -84,6 +84,6 @@ cexpf(float complex z) * - x = NaN (spurious inexact exception from y) */ exp_x = expf(x); - return (cpackf(exp_x * cosf(y), exp_x * sinf(y))); + return (CMPLXF(exp_x * cosf(y), exp_x * sinf(y))); } } |