libm: sync with upstream.
There's potential here to maybe lose some/all of builtins.cpp, but I'll
look at that separately later.
Test: treehugger
Change-Id: I2c2bc1d0753affdd214daeb09fa1ac7cd73db347
diff --git a/libm/upstream-freebsd/lib/msun/src/s_cexpf.c b/libm/upstream-freebsd/lib/msun/src/s_cexpf.c
index b815c99..d905b74 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_cexpf.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_cexpf.c
@@ -41,7 +41,7 @@
float complex
cexpf(float complex z)
{
- float x, y, exp_x;
+ float c, exp_x, s, x, y;
uint32_t hx, hy;
x = crealf(z);
@@ -55,8 +55,10 @@
return (CMPLXF(expf(x), y));
GET_FLOAT_WORD(hx, x);
/* cexp(0 + I y) = cos(y) + I sin(y) */
- if ((hx & 0x7fffffff) == 0)
- return (CMPLXF(cosf(y), sinf(y)));
+ if ((hx & 0x7fffffff) == 0) {
+ sincosf(y, &s, &c);
+ return (CMPLXF(c, s));
+ }
if (hy >= 0x7f800000) {
if ((hx & 0x7fffffff) != 0x7f800000) {
@@ -86,6 +88,7 @@
* - x = NaN (spurious inexact exception from y)
*/
exp_x = expf(x);
- return (CMPLXF(exp_x * cosf(y), exp_x * sinf(y)));
+ sincosf(y, &s, &c);
+ return (CMPLXF(exp_x * c, exp_x * s));
}
}