View | Details | Raw Unified | Return to bug 229876
Collapse All | Expand All

(-)lib/msun/Makefile (-1 lines)
Lines 56-62 Link Here
56
	imprecise.c \
58
	imprecise.c \
57
	k_cos.c k_cosf.c k_exp.c k_expf.c k_rem_pio2.c k_sin.c k_sinf.c \
59
	k_cos.c k_cosf.c k_exp.c k_expf.c k_rem_pio2.c k_sin.c k_sinf.c \
58
	k_tan.c k_tanf.c \
60
	k_tan.c k_tanf.c \
59
	polevll.c \
60
	s_asinh.c s_asinhf.c s_atan.c s_atanf.c s_carg.c s_cargf.c s_cargl.c \
61
	s_asinh.c s_asinhf.c s_atan.c s_atanf.c s_carg.c s_cargf.c s_cargl.c \
61
	s_cbrt.c s_cbrtf.c s_ceil.c s_ceilf.c s_clog.c s_clogf.c \
62
	s_cbrt.c s_cbrtf.c s_ceil.c s_ceilf.c s_clog.c s_clogf.c \
62
	s_copysign.c s_copysignf.c s_cos.c s_cosf.c \
63
	s_copysign.c s_copysignf.c s_cos.c s_cosf.c \
(-)lib/msun/ld80/e_powl.c (-1 / +47 lines)
Lines 14-19 Link Here
14
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
 */
15
 */
16
16
17
#include <sys/cdefs.h>
18
__FBSDID("$FreeBSD$");
19
20
#include <math.h>
21
22
#include "math_private.h"
23
24
/*
25
 * Polynomial evaluator:
26
 *  P[0] x^n  +  P[1] x^(n-1)  +  ...  +  P[n]
27
 */
28
static inline long double
29
__polevll(long double x, long double *PP, int n)
30
{
31
	long double y;
32
	long double *P;
33
34
	P = PP;
35
	y = *P++;
36
	do {
37
		y = y * x + *P++;
38
	} while (--n);
39
40
	return (y);
41
}
42
43
/*
44
 * Polynomial evaluator:
45
 *  x^n  +  P[0] x^(n-1)  +  P[1] x^(n-2)  +  ...  +  P[n]
46
 */
47
static inline long double
48
__p1evll(long double x, long double *PP, int n)
49
{
50
	long double y;
51
	long double *P;
52
53
	P = PP;
54
	n -= 1;
55
	y = x + *P++;
56
	do {
57
		y = y * x + *P++;
58
	} while (--n);
59
60
	return (y);
61
}
62
17
/*							powl.c
63
/*							powl.c
18
 *
64
 *
19
 *	Power function, long double precision
65
 *	Power function, long double precision
Lines 467-473 Link Here
467
513
468
514
469
/* Find a multiple of 1/NXT that is within 1/NXT of x. */
515
/* Find a multiple of 1/NXT that is within 1/NXT of x. */
470
static long double
516
static inline long double
471
reducl(long double x)
517
reducl(long double x)
472
{
518
{
473
long double t;
519
long double t;
(-)lib/msun/man/exp.3 (-9 / +2 lines)
Lines 180-195 Link Here
180
then \*(Na**0 = 1 too because x**0 = 1 for all finite
180
then \*(Na**0 = 1 too because x**0 = 1 for all finite
181
and infinite x, i.e., independently of x.
181
and infinite x, i.e., independently of x.
182
.El
182
.El
183
.Sh BUGS
184
To conform with newer C/C++ standards, a stub implementation for
185
.Nm powl
186
was committed to the math library, where
187
.Nm powl
188
is mapped to
189
.Nm pow .
190
Thus, the numerical accuracy is at most that of the 53-bit double
191
precision implementation.
192
.Sh SEE ALSO
183
.Sh SEE ALSO
184
.Xr clog 3
185
.Xr cpow 3
193
.Xr fenv 3 ,
186
.Xr fenv 3 ,
194
.Xr ldexp 3 ,
187
.Xr ldexp 3 ,
195
.Xr log 3 ,
188
.Xr log 3 ,
(-)lib/msun/src/math_private.h (-3 lines)
Lines 828-834 Link Here
828
long double __kernel_cosl(long double, long double);
828
long double __kernel_cosl(long double, long double);
829
long double __kernel_tanl(long double, long double, int);
829
long double __kernel_tanl(long double, long double, int);
830
830
831
long double __p1evll(long double, void *, int);
832
long double __polevll(long double, void *, int);
833
834
#endif /* !_MATH_PRIVATE_H_ */
831
#endif /* !_MATH_PRIVATE_H_ */
(-)lib/msun/src/s_cpow.c (-2 / +2 lines)
Lines 60-66 Link Here
60
	y = cimag (z);
60
	y = cimag (z);
61
	absa = cabs (a);
61
	absa = cabs (a);
62
	if (absa == 0.0) {
62
	if (absa == 0.0) {
63
		return (0.0 + 0.0 * I);
63
		return (CMPLX(0.0, 0.0));
64
	}
64
	}
65
	arga = carg (a);
65
	arga = carg (a);
66
	r = pow (absa, x);
66
	r = pow (absa, x);
Lines 69-74 Link Here
69
		r = r * exp (-y * arga);
69
		r = r * exp (-y * arga);
70
		theta = theta + y * log (absa);
70
		theta = theta + y * log (absa);
71
	}
71
	}
72
	w = r * cos (theta) + (r * sin (theta)) * I;
72
	w = CMPLX(r * cos (theta),  r * sin (theta));
73
	return (w);
73
	return (w);
74
}
74
}
(-)lib/msun/src/s_cpowf.c (-2 / +2 lines)
Lines 59-65 Link Here
59
	y = cimagf(z);
59
	y = cimagf(z);
60
	absa = cabsf (a);
60
	absa = cabsf (a);
61
	if (absa == 0.0f) {
61
	if (absa == 0.0f) {
62
		return (0.0f + 0.0f * I);
62
		return (CMPLXF(0.0f, 0.0f));
63
	}
63
	}
64
	arga = cargf (a);
64
	arga = cargf (a);
65
	r = powf (absa, x);
65
	r = powf (absa, x);
Lines 68-73 Link Here
68
		r = r * expf (-y * arga);
68
		r = r * expf (-y * arga);
69
		theta = theta + y * logf (absa);
69
		theta = theta + y * logf (absa);
70
	}
70
	}
71
	w = r * cosf (theta) + (r * sinf (theta)) * I;
71
	w = CMPLXF(r * cosf (theta), r * sinf (theta));
72
	return (w);
72
	return (w);
73
}
73
}
(-)lib/msun/src/s_cpowl.c (-2 / +2 lines)
Lines 59-65 Link Here
59
	y = cimagl(z);
59
	y = cimagl(z);
60
	absa = cabsl(a);
60
	absa = cabsl(a);
61
	if (absa == 0.0L) {
61
	if (absa == 0.0L) {
62
		return (0.0L + 0.0L * I);
62
		return (CMPLXL(0.0L, 0.0L));
63
	}
63
	}
64
	arga = cargl(a);
64
	arga = cargl(a);
65
	r = powl(absa, x);
65
	r = powl(absa, x);
Lines 68-73 Link Here
68
		r = r * expl(-y * arga);
68
		r = r * expl(-y * arga);
69
		theta = theta + y * logl(absa);
69
		theta = theta + y * logl(absa);
70
	}
70
	}
71
	w = r * cosl(theta) + (r * sinl(theta)) * I;
71
	w = CMPLXL(r * cosl(theta), r * sinl(theta));
72
	return (w);
72
	return (w);
73
}
73
}

Return to bug 229876