Print this page
11210 libm should be cstyle(1ONBLD) clean
@@ -16,13 +16,15 @@
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
+
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
+
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -36,11 +38,12 @@
#endif
static const float zero = 0.0F;
fcomplex
-cexpf(fcomplex z) {
+cexpf(fcomplex z)
+{
fcomplex ans;
float x, y, c, s;
double t;
int n, ix, iy, hx, hy;
@@ -48,10 +51,11 @@
y = F_IM(z);
hx = THE_WORD(x);
hy = THE_WORD(y);
ix = hx & 0x7fffffff;
iy = hy & 0x7fffffff;
+
if (iy == 0) { /* y = 0 */
F_RE(ans) = expf(x);
F_IM(ans) = y;
} else if (ix == 0x7f800000) { /* x is +-inf */
if (hx < 0) {
@@ -73,10 +77,11 @@
F_IM(ans) = x * s;
}
}
} else {
sincosf(y, &s, &c);
+
if (ix >= 0x42B171AA) { /* |x| > 88.722... ~ log(2**128) */
#if defined(__i386) && !defined(__amd64)
int rp = __swapRP(fp_extended);
#endif
t = __k_cexp(x, &n);
@@ -90,7 +95,8 @@
t = expf(x);
F_RE(ans) = t * c;
F_IM(ans) = t * s;
}
}
+
return (ans);
}