aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-07-19 18:44:10 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-07-19 18:44:10 +0000
commit2ae9055f49d1ded1633ffdcdb2eabd7a4fbba308 (patch)
tree9a0adddad5e05f81e08d68d0377a0bb6d2cecfd8 /lib
parentacfbf5901384e07ff4b54ef1d6a8480eed6e223e (diff)
Notes
Diffstat (limited to 'lib')
-rw-r--r--lib/msun/Makefile1
-rw-r--r--lib/msun/ld80/e_powl.c48
-rw-r--r--lib/msun/man/exp.311
-rw-r--r--lib/msun/src/math_private.h3
-rw-r--r--lib/msun/src/polevll.c105
-rw-r--r--lib/msun/src/s_cpow.c4
-rw-r--r--lib/msun/src/s_cpowf.c4
-rw-r--r--lib/msun/src/s_cpowl.c4
8 files changed, 55 insertions, 125 deletions
diff --git a/lib/msun/Makefile b/lib/msun/Makefile
index f0447485d98c..0cba3fc8b53b 100644
--- a/lib/msun/Makefile
+++ b/lib/msun/Makefile
@@ -56,7 +56,6 @@ 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 \
diff --git a/lib/msun/ld80/e_powl.c b/lib/msun/ld80/e_powl.c
index 87c75688d61d..ea25354c2aa2 100644
--- a/lib/msun/ld80/e_powl.c
+++ b/lib/msun/ld80/e_powl.c
@@ -14,6 +14,52 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <math.h>
+
+#include "math_private.h"
+
+/*
+ * Polynomial evaluator:
+ * P[0] x^n + P[1] x^(n-1) + ... + P[n]
+ */
+static inline long double
+__polevll(long double x, long double *PP, int n)
+{
+ long double y;
+ long double *P;
+
+ P = PP;
+ y = *P++;
+ do {
+ y = y * x + *P++;
+ } while (--n);
+
+ return (y);
+}
+
+/*
+ * Polynomial evaluator:
+ * x^n + P[0] x^(n-1) + P[1] x^(n-2) + ... + P[n]
+ */
+static inline long double
+__p1evll(long double x, long double *PP, int n)
+{
+ long double y;
+ long double *P;
+
+ P = PP;
+ n -= 1;
+ y = x + *P++;
+ do {
+ y = y * x + *P++;
+ } while (--n);
+
+ return (y);
+}
+
/* powl.c
*
* Power function, long double precision
@@ -467,7 +513,7 @@ return( z );
/* Find a multiple of 1/NXT that is within 1/NXT of x. */
-static long double
+static inline long double
reducl(long double x)
{
long double t;
diff --git a/lib/msun/man/exp.3 b/lib/msun/man/exp.3
index 855e58a59b5c..213f9141857e 100644
--- a/lib/msun/man/exp.3
+++ b/lib/msun/man/exp.3
@@ -180,16 +180,9 @@ If 0**0 = 1, then
then \*(Na**0 = 1 too because x**0 = 1 for all finite
and infinite x, i.e., independently of x.
.El
-.Sh BUGS
-To conform with newer C/C++ standards, a stub implementation for
-.Nm powl
-was committed to the math library, where
-.Nm powl
-is mapped to
-.Nm pow .
-Thus, the numerical accuracy is at most that of the 53-bit double
-precision implementation.
.Sh SEE ALSO
+.Xr clog 3
+.Xr cpow 3
.Xr fenv 3 ,
.Xr ldexp 3 ,
.Xr log 3 ,
diff --git a/lib/msun/src/math_private.h b/lib/msun/src/math_private.h
index 1b1105e1c3ac..4c9fb3046505 100644
--- a/lib/msun/src/math_private.h
+++ b/lib/msun/src/math_private.h
@@ -846,7 +846,4 @@ long double __kernel_sinl(long double, long double, int);
long double __kernel_cosl(long double, long double);
long double __kernel_tanl(long double, long double, int);
-long double __p1evll(long double, void *, int);
-long double __polevll(long double, void *, int);
-
#endif /* !_MATH_PRIVATE_H_ */
diff --git a/lib/msun/src/polevll.c b/lib/msun/src/polevll.c
deleted file mode 100644
index a824f22f86ba..000000000000
--- a/lib/msun/src/polevll.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*-
- * Copyright (c) 2008 Stephen L. Moshier <steve@moshier.net>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* polevll.c
- * p1evll.c
- *
- * Evaluate polynomial
- *
- *
- *
- * SYNOPSIS:
- *
- * int N;
- * long double x, y, coef[N+1], polevl[];
- *
- * y = polevll( x, coef, N );
- *
- *
- *
- * DESCRIPTION:
- *
- * Evaluates polynomial of degree N:
- *
- * 2 N
- * y = C + C x + C x +...+ C x
- * 0 1 2 N
- *
- * Coefficients are stored in reverse order:
- *
- * coef[0] = C , ..., coef[N] = C .
- * N 0
- *
- * The function p1evll() assumes that coef[N] = 1.0 and is
- * omitted from the array. Its calling arguments are
- * otherwise the same as polevll().
- *
- *
- * SPEED:
- *
- * In the interest of speed, there are no checks for out
- * of bounds arithmetic. This routine is used by most of
- * the functions in the library. Depending on available
- * equipment features, the user may wish to rewrite the
- * program in microcode or assembly language.
- *
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <math.h>
-
-#include "math_private.h"
-
-/*
- * Polynomial evaluator:
- * P[0] x^n + P[1] x^(n-1) + ... + P[n]
- */
-long double
-__polevll(long double x, void *PP, int n)
-{
- long double y;
- long double *P;
-
- P = (long double *)PP;
- y = *P++;
- do {
- y = y * x + *P++;
- } while (--n);
-
- return (y);
-}
-
-/*
- * Polynomial evaluator:
- * x^n + P[0] x^(n-1) + P[1] x^(n-2) + ... + P[n]
- */
-long double
-__p1evll(long double x, void *PP, int n)
-{
- long double y;
- long double *P;
-
- P = (long double *)PP;
- n -= 1;
- y = x + *P++;
- do {
- y = y * x + *P++;
- } while (--n);
-
- return (y);
-}
diff --git a/lib/msun/src/s_cpow.c b/lib/msun/src/s_cpow.c
index 628b201f39be..dd7bae2f545d 100644
--- a/lib/msun/src/s_cpow.c
+++ b/lib/msun/src/s_cpow.c
@@ -60,7 +60,7 @@ cpow(double complex a, double complex z)
y = cimag (z);
absa = cabs (a);
if (absa == 0.0) {
- return (0.0 + 0.0 * I);
+ return (CMPLX(0.0, 0.0));
}
arga = carg (a);
r = pow (absa, x);
@@ -69,6 +69,6 @@ cpow(double complex a, double complex z)
r = r * exp (-y * arga);
theta = theta + y * log (absa);
}
- w = r * cos (theta) + (r * sin (theta)) * I;
+ w = CMPLX(r * cos (theta), r * sin (theta));
return (w);
}
diff --git a/lib/msun/src/s_cpowf.c b/lib/msun/src/s_cpowf.c
index aa1eb756f1b6..3f7d247ae2a2 100644
--- a/lib/msun/src/s_cpowf.c
+++ b/lib/msun/src/s_cpowf.c
@@ -59,7 +59,7 @@ cpowf(float complex a, float complex z)
y = cimagf(z);
absa = cabsf (a);
if (absa == 0.0f) {
- return (0.0f + 0.0f * I);
+ return (CMPLXF(0.0f, 0.0f));
}
arga = cargf (a);
r = powf (absa, x);
@@ -68,6 +68,6 @@ cpowf(float complex a, float complex z)
r = r * expf (-y * arga);
theta = theta + y * logf (absa);
}
- w = r * cosf (theta) + (r * sinf (theta)) * I;
+ w = CMPLXF(r * cosf (theta), r * sinf (theta));
return (w);
}
diff --git a/lib/msun/src/s_cpowl.c b/lib/msun/src/s_cpowl.c
index f2c82f1f107a..b5b9f43258ff 100644
--- a/lib/msun/src/s_cpowl.c
+++ b/lib/msun/src/s_cpowl.c
@@ -59,7 +59,7 @@ cpowl(long double complex a, long double complex z)
y = cimagl(z);
absa = cabsl(a);
if (absa == 0.0L) {
- return (0.0L + 0.0L * I);
+ return (CMPLXL(0.0L, 0.0L));
}
arga = cargl(a);
r = powl(absa, x);
@@ -68,6 +68,6 @@ cpowl(long double complex a, long double complex z)
r = r * expl(-y * arga);
theta = theta + y * logl(absa);
}
- w = r * cosl(theta) + (r * sinl(theta)) * I;
+ w = CMPLXL(r * cosl(theta), r * sinl(theta));
return (w);
}