Skip to content

Commit

Permalink
msun: add ld80/ld128 powl, cpow, cpowf, cpowl from openbsd
Browse files Browse the repository at this point in the history
This corresponds to the latest status (hasn't changed in 9+
years) from openbsd of ld80/ld128 powl, and source cpowf, cpow,
cpowl (the complex power functions for float complex, double
complex, and long double complex) which are required for C99
compliance and were missing from FreeBSD. Also required for
some numerical codes using complex numbered Hamiltonians.

Thanks to jhb for tracking down the issue with making
weak_reference compile on powerpc.

When asked to review, bde said "I don't like it" - but
provided no actionable feedback or superior implementations.

Discussed with: jhb
Submitted by: jmd
Differential Revision: https://reviews.freebsd.org/D15919
  • Loading branch information
mattmacy committed Jul 15, 2018
1 parent c8b1bdc commit 6813d08
Show file tree
Hide file tree
Showing 14 changed files with 1,511 additions and 16 deletions.
4 changes: 4 additions & 0 deletions include/complex.h
Expand Up @@ -109,6 +109,10 @@ double complex conj(double complex) __pure2;
float complex conjf(float complex) __pure2;
long double complex
conjl(long double complex) __pure2;
float complex cpowf(float complex, float complex);
double complex cpow(double complex, double complex);
long double complex
cpowl(long double complex, long double complex);
float complex cprojf(float complex) __pure2;
double complex cproj(double complex) __pure2;
long double complex
Expand Down
7 changes: 5 additions & 2 deletions lib/msun/Makefile
Expand Up @@ -56,6 +56,7 @@ COMMON_SRCS= b_exp.c b_log.c b_tgamma.c \
imprecise.c \
k_cos.c k_cosf.c k_exp.c k_expf.c k_rem_pio2.c k_sin.c k_sinf.c \
k_tan.c k_tanf.c \
polevll.c \
s_asinh.c s_asinhf.c s_atan.c s_atanf.c s_carg.c s_cargf.c s_cargl.c \
s_cbrt.c s_cbrtf.c s_ceil.c s_ceilf.c s_clog.c s_clogf.c \
s_copysign.c s_copysignf.c s_cos.c s_cosf.c \
Expand Down Expand Up @@ -98,7 +99,7 @@ COMMON_SRCS+= s_copysignl.c s_fabsl.c s_llrintl.c s_lrintl.c s_modfl.c
COMMON_SRCS+= catrigl.c \
e_acoshl.c e_acosl.c e_asinl.c e_atan2l.c e_atanhl.c \
e_coshl.c e_fmodl.c e_hypotl.c \
e_lgammal.c e_lgammal_r.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 \
Expand All @@ -115,6 +116,7 @@ COMMON_SRCS+= catrig.c catrigf.c \
s_ccosh.c s_ccoshf.c s_cexp.c s_cexpf.c \
s_cimag.c s_cimagf.c s_cimagl.c \
s_conj.c s_conjf.c s_conjl.c \
s_cpow.c s_cpowf.c s_cpowl.c \
s_cproj.c s_cprojf.c s_creal.c s_crealf.c s_creall.c \
s_csinh.c s_csinhf.c s_ctanh.c s_ctanhf.c

Expand All @@ -134,7 +136,7 @@ INCS+= fenv.h math.h

MAN= acos.3 acosh.3 asin.3 asinh.3 atan.3 atan2.3 atanh.3 \
ceil.3 cacos.3 ccos.3 ccosh.3 cexp.3 \
cimag.3 clog.3 copysign.3 cos.3 cosh.3 csqrt.3 erf.3 \
cimag.3 clog.3 copysign.3 cos.3 cosh.3 cpow.3 csqrt.3 erf.3 \
exp.3 fabs.3 fdim.3 \
feclearexcept.3 feenableexcept.3 fegetenv.3 \
fegetround.3 fenv.3 floor.3 \
Expand Down Expand Up @@ -172,6 +174,7 @@ MLINKS+=clog.3 clogf.3 clog.3 clogl.3
MLINKS+=copysign.3 copysignf.3 copysign.3 copysignl.3
MLINKS+=cos.3 cosf.3 cos.3 cosl.3
MLINKS+=cosh.3 coshf.3 cosh.3 coshl.3
MLINKS+=cpow.3 cpowf.3 cpow.3 cpowl.3
MLINKS+=csqrt.3 csqrtf.3 csqrt.3 csqrtl.3
MLINKS+=erf.3 erfc.3 erf.3 erff.3 erf.3 erfcf.3 erf.3 erfl.3 erf.3 erfcl.3
MLINKS+=exp.3 expm1.3 exp.3 expm1f.3 exp.3 expm1l.3 exp.3 pow.3 exp.3 powf.3 \
Expand Down
5 changes: 4 additions & 1 deletion lib/msun/Symbol.map
Expand Up @@ -274,10 +274,10 @@ FBSD_1.3 {
log1pl;
log2l;
logl;
powl;
sinhl;
tanhl;
/* Implemented as weak aliases for imprecise versions */
powl;
tgammal;
};

Expand All @@ -297,6 +297,9 @@ FBSD_1.5 {
clog;
clogf;
clogl;
cpow;
cpowf;
cpowl;
sincos;
sincosf;
sincosl;
Expand Down

1 comment on commit 6813d08

@grahamperrin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bsdjhb @jmd-intel @mattmacy FYI, I mentioned this 2018 commit whilst closing 2019 FreeBSD bug 237771 – clog(3), cpow(3) are missing on 11.2.

Please sign in to comment.