diff options
author | Stefan Eßer <se@FreeBSD.org> | 2020-09-20 05:28:31 +0000 |
---|---|---|
committer | Stefan Eßer <se@FreeBSD.org> | 2020-09-20 05:28:31 +0000 |
commit | a67cc943273ba7cba2f78e33fc5897e1fbecd462 (patch) | |
tree | 14a2ea8cbaa334c0cc49ff7ea43b10994606bb18 /lib/msun | |
parent | 85ee267a3eb58f9aa1a73a1abcf033c5c460b324 (diff) | |
download | src-test2-a67cc943273ba7cba2f78e33fc5897e1fbecd462.tar.gz src-test2-a67cc943273ba7cba2f78e33fc5897e1fbecd462.zip |
Notes
Diffstat (limited to 'lib/msun')
-rw-r--r-- | lib/msun/ld128/k_expl.h | 11 | ||||
-rw-r--r-- | lib/msun/ld80/k_expl.h | 11 |
2 files changed, 12 insertions, 10 deletions
diff --git a/lib/msun/ld128/k_expl.h b/lib/msun/ld128/k_expl.h index 0c4e7015dbbe..159338fe3f81 100644 --- a/lib/msun/ld128/k_expl.h +++ b/lib/msun/ld128/k_expl.h @@ -300,7 +300,7 @@ hexpl(long double x) static inline long double complex __ldexp_cexpl(long double complex z, int expt) { - long double exp_x, hi, lo; + long double c, exp_x, hi, lo, s; long double x, y, scale1, scale2; int half_expt, k; @@ -308,16 +308,17 @@ __ldexp_cexpl(long double complex z, int expt) y = cimagl(z); __k_expl(x, &hi, &lo, &k); - exp_x = (lo + hi) * 0x1p16382; + exp_x = (lo + hi) * 0x1p16382L; expt += k - 16382; scale1 = 1; half_expt = expt / 2; SET_LDBL_EXPSIGN(scale1, BIAS + half_expt); scale2 = 1; - SET_LDBL_EXPSIGN(scale1, BIAS + expt - half_expt); + SET_LDBL_EXPSIGN(scale2, BIAS + expt - half_expt); - return (CMPLXL(cos(y) * exp_x * scale1 * scale2, - sinl(y) * exp_x * scale1 * scale2)); + sincosl(y, &s, &c); + return (CMPLXL(c * exp_x * scale1 * scale2, + s * exp_x * scale1 * scale2)); } #endif /* _COMPLEX_H */ diff --git a/lib/msun/ld80/k_expl.h b/lib/msun/ld80/k_expl.h index 63c65b65cf6e..a744d2d38127 100644 --- a/lib/msun/ld80/k_expl.h +++ b/lib/msun/ld80/k_expl.h @@ -277,7 +277,7 @@ hexpl(long double x) static inline long double complex __ldexp_cexpl(long double complex z, int expt) { - long double exp_x, hi, lo; + long double c, exp_x, hi, lo, s; long double x, y, scale1, scale2; int half_expt, k; @@ -285,16 +285,17 @@ __ldexp_cexpl(long double complex z, int expt) y = cimagl(z); __k_expl(x, &hi, &lo, &k); - exp_x = (lo + hi) * 0x1p16382; + exp_x = (lo + hi) * 0x1p16382L; expt += k - 16382; scale1 = 1; half_expt = expt / 2; SET_LDBL_EXPSIGN(scale1, BIAS + half_expt); scale2 = 1; - SET_LDBL_EXPSIGN(scale1, BIAS + expt - half_expt); + SET_LDBL_EXPSIGN(scale2, BIAS + expt - half_expt); - return (CMPLXL(cos(y) * exp_x * scale1 * scale2, - sinl(y) * exp_x * scale1 * scale2)); + sincosl(y, &s, &c); + return (CMPLXL(c * exp_x * scale1 * scale2, + s * exp_x * scale1 * scale2)); } #endif /* _COMPLEX_H */ |