Lines 30-35
Link Here
|
30 |
__FBSDID("$FreeBSD$"); |
30 |
__FBSDID("$FreeBSD$"); |
31 |
|
31 |
|
32 |
#include <complex.h> |
32 |
#include <complex.h> |
|
|
33 |
#include <float.h> |
33 |
#include <math.h> |
34 |
#include <math.h> |
34 |
|
35 |
|
35 |
#include "math_private.h" |
36 |
#include "math_private.h" |
Lines 41-47
cexp_ovfl = 0x4096b8e4; /* (MAX_EXP - MIN_DENORM_EXP) * ln2 */
Link Here
|
41 |
double complex |
42 |
double complex |
42 |
cexp(double complex z) |
43 |
cexp(double complex z) |
43 |
{ |
44 |
{ |
44 |
double x, y, exp_x; |
45 |
double c, exp_x, s, x, y; |
45 |
uint32_t hx, hy, lx, ly; |
46 |
uint32_t hx, hy, lx, ly; |
46 |
|
47 |
|
47 |
x = creal(z); |
48 |
x = creal(z); |
Lines 55-62
cexp(double complex z)
Link Here
|
55 |
return (CMPLX(exp(x), y)); |
56 |
return (CMPLX(exp(x), y)); |
56 |
EXTRACT_WORDS(hx, lx, x); |
57 |
EXTRACT_WORDS(hx, lx, x); |
57 |
/* cexp(0 + I y) = cos(y) + I sin(y) */ |
58 |
/* cexp(0 + I y) = cos(y) + I sin(y) */ |
58 |
if (((hx & 0x7fffffff) | lx) == 0) |
59 |
if (((hx & 0x7fffffff) | lx) == 0) { |
59 |
return (CMPLX(cos(y), sin(y))); |
60 |
sincos(y, &s, &c); |
|
|
61 |
return (CMPLX(c, s)); |
62 |
} |
60 |
|
63 |
|
61 |
if (hy >= 0x7ff00000) { |
64 |
if (hy >= 0x7ff00000) { |
62 |
if (lx != 0 || (hx & 0x7fffffff) != 0x7ff00000) { |
65 |
if (lx != 0 || (hx & 0x7fffffff) != 0x7ff00000) { |
Lines 86-91
cexp(double complex z)
Link Here
|
86 |
* - x = NaN (spurious inexact exception from y) |
89 |
* - x = NaN (spurious inexact exception from y) |
87 |
*/ |
90 |
*/ |
88 |
exp_x = exp(x); |
91 |
exp_x = exp(x); |
89 |
return (CMPLX(exp_x * cos(y), exp_x * sin(y))); |
92 |
sincos(y, &s, &c); |
|
|
93 |
return (CMPLX(exp_x * c, exp_x * s)); |
90 |
} |
94 |
} |
91 |
} |
95 |
} |
|
|
96 |
|
97 |
#if (LDBL_MANT_DIG == 53) |
98 |
__weak_reference(cexp, cexpl); |
99 |
#endif |