FreeBSD Bugzilla – Attachment 195262 Details for
Bug 229876
[libm] Fix powl, cpow, cpowf, and cpowl imports from OpenBSD
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
zxc.diff (text/plain), 4.39 KB, created by
sgk
on 2018-07-18 22:19:50 UTC
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
sgk
Created:
2018-07-18 22:19:50 UTC
Size:
4.39 KB
patch
obsolete
>Index: lib/msun/Makefile >=================================================================== >--- lib/msun/Makefile (revision 336360) >+++ lib/msun/Makefile (working copy) >@@ -56,7 +58,6 @@ > 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 \ >Index: lib/msun/ld80/e_powl.c >=================================================================== >--- lib/msun/ld80/e_powl.c (revision 336360) >+++ lib/msun/ld80/e_powl.c (working copy) >@@ -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 @@ > > > /* 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; >Index: lib/msun/man/exp.3 >=================================================================== >--- lib/msun/man/exp.3 (revision 336360) >+++ lib/msun/man/exp.3 (working copy) >@@ -180,16 +180,9 @@ > 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 , >Index: lib/msun/src/math_private.h >=================================================================== >--- lib/msun/src/math_private.h (revision 336360) >+++ lib/msun/src/math_private.h (working copy) >@@ -828,7 +828,4 @@ > 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_ */ >Index: lib/msun/src/s_cpow.c >=================================================================== >--- lib/msun/src/s_cpow.c (revision 336360) >+++ lib/msun/src/s_cpow.c (working copy) >@@ -60,7 +60,7 @@ > 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 @@ > 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); > } >Index: lib/msun/src/s_cpowf.c >=================================================================== >--- lib/msun/src/s_cpowf.c (revision 336360) >+++ lib/msun/src/s_cpowf.c (working copy) >@@ -59,7 +59,7 @@ > 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 @@ > 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); > } >Index: lib/msun/src/s_cpowl.c >=================================================================== >--- lib/msun/src/s_cpowl.c (revision 336360) >+++ lib/msun/src/s_cpowl.c (working copy) >@@ -59,7 +59,7 @@ > 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 @@ > 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); > }
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 229876
: 195262