Sync libm with upstream FreeBSD.
Upstream SHA 78599c32efed3247d165302a1fbe8d9203e38974.
Test: treehugger
Change-Id: Ib103d211315e320df89a6f0bcb30cd8ba67dd603
diff --git a/libm/upstream-freebsd/lib/msun/src/k_expf.c b/libm/upstream-freebsd/lib/msun/src/k_expf.c
index 5aa5c76..80e629b 100644
--- a/libm/upstream-freebsd/lib/msun/src/k_expf.c
+++ b/libm/upstream-freebsd/lib/msun/src/k_expf.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/msun/src/k_expf.c 326219 2017-11-26 02:00:33Z pfg $");
+__FBSDID("$FreeBSD$");
#include <complex.h>
@@ -71,7 +71,7 @@
float complex
__ldexp_cexpf(float complex z, int expt)
{
- float x, y, exp_x, scale1, scale2;
+ float c, exp_x, s, scale1, scale2, x, y;
int ex_expt, half_expt;
x = crealf(z);
@@ -84,6 +84,7 @@
half_expt = expt - half_expt;
SET_FLOAT_WORD(scale2, (0x7f + half_expt) << 23);
- return (CMPLXF(cosf(y) * exp_x * scale1 * scale2,
- sinf(y) * exp_x * scale1 * scale2));
+ sincosf(y, &s, &c);
+ return (CMPLXF(c * exp_x * scale1 * scale2,
+ s * exp_x * scale1 * scale2));
}