FreeBSD Bugzilla – Attachment 229281 Details for
Bug 216862
C11 conformance: cexpl() is missing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
new diff
cexpl.diff (text/plain), 4.77 KB, created by
Steve Kargl
on 2021-11-05 02:27:15 UTC
(
hide
)
Description:
new diff
Filename:
MIME Type:
Creator:
Steve Kargl
Created:
2021-11-05 02:27:15 UTC
Size:
4.77 KB
patch
obsolete
>diff --git a/include/complex.h b/include/complex.h >index 892bc55e514..c31c15d9da4 100644 >--- a/include/complex.h >+++ b/include/complex.h >@@ -98,6 +98,8 @@ double complex ccosh(double complex); > float complex ccoshf(float complex); > double complex cexp(double complex); > float complex cexpf(float complex); >+long double complex >+ cexpl(long double complex); > double cimag(double complex) __pure2; > float cimagf(float complex) __pure2; > long double cimagl(long double complex) __pure2; >diff --git a/lib/msun/Makefile b/lib/msun/Makefile >index 1d94e371e61..f0797861261 100644 >--- a/lib/msun/Makefile >+++ b/lib/msun/Makefile >@@ -117,7 +117,7 @@ COMMON_SRCS+= catrigl.c \ > e_lgammal.c e_lgammal_r.c e_powl.c \ > e_remainderl.c e_sinhl.c e_sqrtl.c \ > invtrig.c k_cosl.c k_sinl.c k_tanl.c \ >- s_asinhl.c s_atanl.c s_cbrtl.c s_ceill.c \ >+ s_asinhl.c s_atanl.c s_cbrtl.c s_ceill.c s_cexpl.c \ > s_clogl.c s_cosl.c s_cospil.c s_cprojl.c \ > s_csqrtl.c s_erfl.c s_exp2l.c s_expl.c s_floorl.c s_fmal.c \ > s_fmaxl.c s_fminl.c s_frexpl.c s_logbl.c s_logl.c s_nanl.c \ >diff --git a/lib/msun/Symbol.map b/lib/msun/Symbol.map >index 7229e7ef31f..8650d56eb9d 100644 >--- a/lib/msun/Symbol.map >+++ b/lib/msun/Symbol.map >@@ -307,6 +307,7 @@ FBSD_1.5 { > > /* First added in 14.0-CURRENT */ > FBSD_1.7 { >+ cexpl; > cospi; > cospif; > cospil; >diff --git a/lib/msun/man/cexp.3 b/lib/msun/man/cexp.3 >index 776e6cee823..27ab3e9c209 100644 >--- a/lib/msun/man/cexp.3 >+++ b/lib/msun/man/cexp.3 >@@ -24,12 +24,13 @@ > .\" > .\" $FreeBSD$ > .\" >-.Dd March 6, 2011 >+.Dd November 3, 2021 > .Dt CEXP 3 > .Os > .Sh NAME > .Nm cexp , >-.Nm cexpf >+.Nm cexpf , >+.Nm cexpl > .Nd complex exponential functions > .Sh LIBRARY > .Lb libm >@@ -39,11 +40,14 @@ > .Fn cexp "double complex z" > .Ft float complex > .Fn cexpf "float complex z" >+.Ft long double complex >+.Fn cexpl "long double complex z" > .Sh DESCRIPTION > The >-.Fn cexp >+.Fn cexp , >+.Fn cexpf , > and >-.Fn cexpf >+.Fn cexpl > functions compute the complex exponential of > .Fa z , > also known as >@@ -106,8 +110,9 @@ is not finite, the sign of the result is indeterminate. > .Xr math 3 > .Sh STANDARDS > The >-.Fn cexp >+.Fn cexp , >+.Fn cexpf , > and >-.Fn cexpf >+.Fn cexpl > functions conform to > .St -isoC-99 . >diff --git a/lib/msun/man/complex.3 b/lib/msun/man/complex.3 >index f1acfbe6da7..8cc0b7f97c5 100644 >--- a/lib/msun/man/complex.3 >+++ b/lib/msun/man/complex.3 >@@ -24,7 +24,7 @@ > .\" > .\" $FreeBSD$ > .\" >-.Dd June 19, 2018 >+.Dd November 3, 2021 > .Dt COMPLEX 3 > .Os > .Sh NAME >@@ -121,3 +121,9 @@ The > .In complex.h > functions described here conform to > .St -isoC-99 . >+.Sh BUGS >+The power functions, >+.Fn cpowf, cpow , >+and >+.Fn cpowl , >+are implemented, but the code was neither reviewed nor tested. >diff --git a/lib/msun/src/s_cexp.c b/lib/msun/src/s_cexp.c >index 2ef8ba1972c..a1f853eca4c 100644 >--- a/lib/msun/src/s_cexp.c >+++ b/lib/msun/src/s_cexp.c >@@ -30,6 +30,7 @@ > __FBSDID("$FreeBSD$"); > > #include <complex.h> >+#include <float.h> > #include <math.h> > > #include "math_private.h" >@@ -41,7 +42,7 @@ cexp_ovfl = 0x4096b8e4; /* (MAX_EXP - MIN_DENORM_EXP) * ln2 */ > double complex > cexp(double complex z) > { >- double x, y, exp_x; >+ double c, exp_x, s, x, y; > uint32_t hx, hy, lx, ly; > > x = creal(z); >@@ -55,8 +56,10 @@ cexp(double complex z) > return (CMPLX(exp(x), y)); > EXTRACT_WORDS(hx, lx, x); > /* cexp(0 + I y) = cos(y) + I sin(y) */ >- if (((hx & 0x7fffffff) | lx) == 0) >- return (CMPLX(cos(y), sin(y))); >+ if (((hx & 0x7fffffff) | lx) == 0) { >+ sincos(y, &s, &c); >+ return (CMPLX(c, s)); >+ } > > if (hy >= 0x7ff00000) { > if (lx != 0 || (hx & 0x7fffffff) != 0x7ff00000) { >@@ -86,6 +89,11 @@ cexp(double complex z) > * - x = NaN (spurious inexact exception from y) > */ > exp_x = exp(x); >- return (CMPLX(exp_x * cos(y), exp_x * sin(y))); >+ sincos(y, &s, &c); >+ return (CMPLX(exp_x * c, exp_x * s)); > } > } >+ >+#if (LDBL_MANT_DIG == 53) >+__weak_reference(cexp, cexpl); >+#endif >diff --git a/lib/msun/src/s_cexpf.c b/lib/msun/src/s_cexpf.c >index b815c99af89..d905b74ff4b 100644 >--- a/lib/msun/src/s_cexpf.c >+++ b/lib/msun/src/s_cexpf.c >@@ -41,7 +41,7 @@ cexp_ovfl = 0x43400074; /* (MAX_EXP - MIN_DENORM_EXP) * ln2 */ > 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 @@ cexpf(float complex z) > 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 @@ cexpf(float complex z) > * - 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)); > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 216862
:
229279
|
229281
|
229283