View | Details | Raw Unified | Return to bug 216862 | Differences between
and this patch

Collapse All | Expand All

(-)b/include/complex.h (+2 lines)
Lines 98-103 double complex ccosh(double complex); Link Here
98
float complex	ccoshf(float complex);
98
float complex	ccoshf(float complex);
99
double complex	cexp(double complex);
99
double complex	cexp(double complex);
100
float complex	cexpf(float complex);
100
float complex	cexpf(float complex);
101
long double complex
102
		cexpl(long double complex);
101
double		cimag(double complex) __pure2;
103
double		cimag(double complex) __pure2;
102
float		cimagf(float complex) __pure2;
104
float		cimagf(float complex) __pure2;
103
long double	cimagl(long double complex) __pure2;
105
long double	cimagl(long double complex) __pure2;
(-)b/lib/msun/Makefile (-1 / +1 lines)
Lines 117-123 COMMON_SRCS+= catrigl.c \ Link Here
117
	e_lgammal.c e_lgammal_r.c e_powl.c \
117
	e_lgammal.c e_lgammal_r.c e_powl.c \
118
	e_remainderl.c e_sinhl.c e_sqrtl.c \
118
	e_remainderl.c e_sinhl.c e_sqrtl.c \
119
	invtrig.c k_cosl.c k_sinl.c k_tanl.c \
119
	invtrig.c k_cosl.c k_sinl.c k_tanl.c \
120
	s_asinhl.c s_atanl.c s_cbrtl.c s_ceill.c \
120
	s_asinhl.c s_atanl.c s_cbrtl.c s_ceill.c s_cexpl.c \
121
	s_clogl.c s_cosl.c s_cospil.c s_cprojl.c \
121
	s_clogl.c s_cosl.c s_cospil.c s_cprojl.c \
122
	s_csqrtl.c s_erfl.c s_exp2l.c s_expl.c s_floorl.c s_fmal.c \
122
	s_csqrtl.c s_erfl.c s_exp2l.c s_expl.c s_floorl.c s_fmal.c \
123
	s_fmaxl.c s_fminl.c s_frexpl.c s_logbl.c s_logl.c s_nanl.c \
123
	s_fmaxl.c s_fminl.c s_frexpl.c s_logbl.c s_logl.c s_nanl.c \
(-)b/lib/msun/Symbol.map (+1 lines)
Lines 307-312 FBSD_1.5 { Link Here
307
307
308
/* First added in 14.0-CURRENT */
308
/* First added in 14.0-CURRENT */
309
FBSD_1.7 {
309
FBSD_1.7 {
310
	cexpl;
310
	cospi;
311
	cospi;
311
	cospif;
312
	cospif;
312
	cospil;
313
	cospil;
(-)b/lib/msun/man/cexp.3 (-6 / +11 lines)
Lines 24-35 Link Here
24
.\"
24
.\"
25
.\" $FreeBSD$
25
.\" $FreeBSD$
26
.\"
26
.\"
27
.Dd March 6, 2011
27
.Dd November 3, 2021
28
.Dt CEXP 3
28
.Dt CEXP 3
29
.Os
29
.Os
30
.Sh NAME
30
.Sh NAME
31
.Nm cexp ,
31
.Nm cexp ,
32
.Nm cexpf
32
.Nm cexpf ,
33
.Nm cexpl
33
.Nd complex exponential functions
34
.Nd complex exponential functions
34
.Sh LIBRARY
35
.Sh LIBRARY
35
.Lb libm
36
.Lb libm
Lines 39-49 Link Here
39
.Fn cexp "double complex z"
40
.Fn cexp "double complex z"
40
.Ft float complex
41
.Ft float complex
41
.Fn cexpf "float complex z"
42
.Fn cexpf "float complex z"
43
.Ft long double complex
44
.Fn cexpl "long double complex z"
42
.Sh DESCRIPTION
45
.Sh DESCRIPTION
43
The
46
The
44
.Fn cexp
47
.Fn cexp ,
48
.Fn cexpf ,
45
and
49
and
46
.Fn cexpf
50
.Fn cexpl
47
functions compute the complex exponential of
51
functions compute the complex exponential of
48
.Fa z ,
52
.Fa z ,
49
also known as
53
also known as
Lines 106-113 is not finite, the sign of the result is indeterminate. Link Here
106
.Xr math 3
110
.Xr math 3
107
.Sh STANDARDS
111
.Sh STANDARDS
108
The
112
The
109
.Fn cexp
113
.Fn cexp ,
114
.Fn cexpf ,
110
and
115
and
111
.Fn cexpf
116
.Fn cexpl
112
functions conform to
117
functions conform to
113
.St -isoC-99 .
118
.St -isoC-99 .
(-)b/lib/msun/man/complex.3 (-1 / +7 lines)
Lines 24-30 Link Here
24
.\"
24
.\"
25
.\" $FreeBSD$
25
.\" $FreeBSD$
26
.\"
26
.\"
27
.Dd June 19, 2018
27
.Dd November 3, 2021
28
.Dt COMPLEX 3
28
.Dt COMPLEX 3
29
.Os
29
.Os
30
.Sh NAME
30
.Sh NAME
Lines 121-123 The Link Here
121
.In complex.h
121
.In complex.h
122
functions described here conform to
122
functions described here conform to
123
.St -isoC-99 .
123
.St -isoC-99 .
124
.Sh BUGS
125
The power functions,
126
.Fn cpowf, cpow ,
127
and
128
.Fn cpowl ,
129
are implemented, but the code was neither reviewed nor tested.
(-)b/lib/msun/src/s_cexp.c (-4 / +12 lines)
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
(-)b/lib/msun/src/s_cexpf.c (-4 / +7 lines)
Lines 41-47 cexp_ovfl = 0x43400074; /* (MAX_EXP - MIN_DENORM_EXP) * ln2 */ Link Here
41
float complex
41
float complex
42
cexpf(float complex z)
42
cexpf(float complex z)
43
{
43
{
44
	float x, y, exp_x;
44
	float c, exp_x, s, x, y;
45
	uint32_t hx, hy;
45
	uint32_t hx, hy;
46
46
47
	x = crealf(z);
47
	x = crealf(z);
Lines 55-62 cexpf(float complex z) Link Here
55
		return (CMPLXF(expf(x), y));
55
		return (CMPLXF(expf(x), y));
56
	GET_FLOAT_WORD(hx, x);
56
	GET_FLOAT_WORD(hx, x);
57
	/* cexp(0 + I y) = cos(y) + I sin(y) */
57
	/* cexp(0 + I y) = cos(y) + I sin(y) */
58
	if ((hx & 0x7fffffff) == 0)
58
	if ((hx & 0x7fffffff) == 0) {
59
		return (CMPLXF(cosf(y), sinf(y)));
59
		sincosf(y, &s, &c);
60
		return (CMPLXF(c, s));
61
	}
60
62
61
	if (hy >= 0x7f800000) {
63
	if (hy >= 0x7f800000) {
62
		if ((hx & 0x7fffffff) != 0x7f800000) {
64
		if ((hx & 0x7fffffff) != 0x7f800000) {
Lines 86-91 cexpf(float complex z) Link Here
86
		 *  -  x = NaN (spurious inexact exception from y)
88
		 *  -  x = NaN (spurious inexact exception from y)
87
		 */
89
		 */
88
		exp_x = expf(x);
90
		exp_x = expf(x);
89
		return (CMPLXF(exp_x * cosf(y), exp_x * sinf(y)));
91
		sincosf(y, &s, &c);
92
		return (CMPLXF(exp_x * c, exp_x * s));
90
	}
93
	}
91
}
94
}

Return to bug 216862