зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1760633: Update fdlibm patches to apply to new files r=arai
Differential Revision: https://phabricator.services.mozilla.com/D164816
This commit is contained in:
Родитель
e7c14c578a
Коммит
b674b7a1fb
|
@ -1,7 +1,7 @@
|
|||
diff --git a/fdlibm.h b/fdlibm.h
|
||||
--- a/fdlibm.h
|
||||
+++ b/fdlibm.h
|
||||
@@ -12,504 +12,51 @@
|
||||
@@ -12,504 +12,66 @@
|
||||
/*
|
||||
* from: @(#)fdlibm.h 5.1 93/09/24
|
||||
* $FreeBSD$
|
||||
|
@ -130,7 +130,7 @@ diff --git a/fdlibm.h b/fdlibm.h
|
|||
-#define M_LN2 0.69314718055994530942 /* log e2 */
|
||||
-#define M_LN10 2.30258509299404568402 /* log e10 */
|
||||
-#define M_PI 3.14159265358979323846 /* pi */
|
||||
-#define M_PI_2 1.57079632679489661923 /* pi/2 */
|
||||
#define M_PI_2 1.57079632679489661923 /* pi/2 */
|
||||
-#define M_PI_4 0.78539816339744830962 /* pi/4 */
|
||||
-#define M_1_PI 0.31830988618379067154 /* 1/pi */
|
||||
-#define M_2_PI 0.63661977236758134308 /* 2/pi */
|
||||
|
@ -256,7 +256,7 @@ diff --git a/fdlibm.h b/fdlibm.h
|
|||
double cbrt(double);
|
||||
-double erf(double);
|
||||
-double erfc(double);
|
||||
-double exp2(double);
|
||||
double exp2(double);
|
||||
double expm1(double);
|
||||
-double fma(double, double, double);
|
||||
double hypot(double, double);
|
||||
|
@ -330,20 +330,20 @@ diff --git a/fdlibm.h b/fdlibm.h
|
|||
-
|
||||
-/* float versions of ANSI/POSIX functions */
|
||||
-#if __ISO_C_VISIBLE >= 1999
|
||||
-float acosf(float);
|
||||
-float asinf(float);
|
||||
-float atanf(float);
|
||||
float acosf(float);
|
||||
float asinf(float);
|
||||
float atanf(float);
|
||||
-float atan2f(float, float);
|
||||
-float cosf(float);
|
||||
-float sinf(float);
|
||||
-float tanf(float);
|
||||
float cosf(float);
|
||||
float sinf(float);
|
||||
float tanf(float);
|
||||
-
|
||||
-float coshf(float);
|
||||
-float sinhf(float);
|
||||
-float tanhf(float);
|
||||
-
|
||||
-float exp2f(float);
|
||||
-float expf(float);
|
||||
float exp2f(float);
|
||||
float expf(float);
|
||||
-float expm1f(float);
|
||||
-float frexpf(float, int *); /* fundamentally !__pure2 */
|
||||
-int ilogbf(float) __pure2;
|
||||
|
@ -351,14 +351,15 @@ diff --git a/fdlibm.h b/fdlibm.h
|
|||
-float log10f(float);
|
||||
-float log1pf(float);
|
||||
-float log2f(float);
|
||||
-float logf(float);
|
||||
float logf(float);
|
||||
-float modff(float, float *); /* fundamentally !__pure2 */
|
||||
-
|
||||
-float powf(float, float);
|
||||
-float sqrtf(float);
|
||||
float powf(float, float);
|
||||
float sqrtf(float);
|
||||
|
||||
float ceilf(float);
|
||||
-float fabsf(float) __pure2;
|
||||
+float fabsf(float);
|
||||
float floorf(float);
|
||||
-float fmodf(float, float);
|
||||
-float roundf(float);
|
||||
|
@ -386,7 +387,7 @@ diff --git a/fdlibm.h b/fdlibm.h
|
|||
-float remquof(float, float, int *);
|
||||
float rintf(float);
|
||||
-float scalblnf(float, long);
|
||||
-float scalbnf(float, int);
|
||||
float scalbnf(float, int);
|
||||
float truncf(float);
|
||||
|
||||
-float fdimf(float, float);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
diff --git a/fdlibm.h b/fdlibm.h
|
||||
--- a/fdlibm.h
|
||||
+++ b/fdlibm.h
|
||||
@@ -9,18 +9,18 @@
|
||||
--- a/fdlibm.h 2022-12-13 14:27:29.092805897 -0500
|
||||
+++ b/fdlibm.h 2022-12-13 14:27:37.444836016 -0500
|
||||
@@ -9,18 +9,21 @@
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
|
@ -13,23 +12,26 @@ diff --git a/fdlibm.h b/fdlibm.h
|
|||
-#ifndef _MATH_H_
|
||||
-#define _MATH_H_
|
||||
+#ifndef mozilla_imported_fdlibm_h
|
||||
+#define mozilla_imported_fdlibm_h
|
||||
|
||||
+#define mozilla_imported_fdlibm_h
|
||||
|
||||
+#ifndef M_PI_2
|
||||
#define M_PI_2 1.57079632679489661923 /* pi/2 */
|
||||
+#endif
|
||||
+
|
||||
double acos(double);
|
||||
double asin(double);
|
||||
double atan(double);
|
||||
double atan2(double, double);
|
||||
double cos(double);
|
||||
double sin(double);
|
||||
double tan(double);
|
||||
@@ -54,9 +54,9 @@ double scalbn(double, int);
|
||||
double trunc(double);
|
||||
|
||||
@@ -69,9 +72,9 @@
|
||||
float ceilf(float);
|
||||
float fabsf(float);
|
||||
float floorf(float);
|
||||
float nearbyintf(float);
|
||||
float rintf(float);
|
||||
float scalbnf(float, int);
|
||||
float truncf(float);
|
||||
|
||||
-#endif /* !_MATH_H_ */
|
||||
+#endif /* mozilla_imported_fdlibm_h */
|
||||
+#endif /* !mozilla_imported_fdlibm_h */
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
diff --git a/fdlibm.h b/fdlibm.h
|
||||
--- a/fdlibm.h
|
||||
+++ b/fdlibm.h
|
||||
@@ -12,16 +12,18 @@
|
||||
--- a/fdlibm.h 2022-12-13 14:28:36.393051585 -0500
|
||||
+++ b/fdlibm.h 2022-12-13 14:28:47.533092878 -0500
|
||||
@@ -12,19 +12,21 @@
|
||||
/*
|
||||
* from: @(#)fdlibm.h 5.1 93/09/24
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef mozilla_imported_fdlibm_h
|
||||
#define mozilla_imported_fdlibm_h
|
||||
#define mozilla_imported_fdlibm_h
|
||||
|
||||
+namespace fdlibm {
|
||||
+
|
||||
#ifndef M_PI_2
|
||||
#define M_PI_2 1.57079632679489661923 /* pi/2 */
|
||||
#endif
|
||||
|
||||
double acos(double);
|
||||
double asin(double);
|
||||
double atan(double);
|
||||
|
@ -19,16 +22,15 @@ diff --git a/fdlibm.h b/fdlibm.h
|
|||
double cos(double);
|
||||
double sin(double);
|
||||
double tan(double);
|
||||
|
||||
@@ -54,9 +56,11 @@ double scalbn(double, int);
|
||||
double trunc(double);
|
||||
|
||||
@@ -69,9 +71,11 @@
|
||||
float ceilf(float);
|
||||
float fabsf(float);
|
||||
float floorf(float);
|
||||
float nearbyintf(float);
|
||||
float rintf(float);
|
||||
float scalbnf(float, int);
|
||||
float truncf(float);
|
||||
|
||||
+} /* namespace fdlibm */
|
||||
+
|
||||
#endif /* mozilla_imported_fdlibm_h */
|
||||
#endif /* !mozilla_imported_fdlibm_h */
|
||||
|
|
|
@ -761,6 +761,28 @@ diff --git a/s_scalbn.cpp b/s_scalbn.cpp
|
|||
if (n > 1023) {
|
||||
y *= 0x1p1023;
|
||||
n -= 1023;
|
||||
diff --git a/s_scalbnf.cpp b/s_scalbnf.cpp
|
||||
--- a/s_scalbnf.cpp
|
||||
+++ b/s_scalbnf.cpp
|
||||
@@ -8,16 +4,17 @@
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Please see https://git.musl-libc.org/cgit/musl/tree/COPYRIGHT
|
||||
* for all contributors to musl.
|
||||
*/
|
||||
-#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
+#include "math_private.h"
|
||||
+
|
||||
float scalbnf(float x, int n)
|
||||
{
|
||||
union {float f; uint32_t i;} u;
|
||||
float_t y = x;
|
||||
|
||||
if (n > 127) {
|
||||
y *= 0x1p127f;
|
||||
n -= 127;
|
||||
diff --git a/s_sin.cpp b/s_sin.cpp
|
||||
--- a/s_sin.cpp
|
||||
+++ b/s_sin.cpp
|
||||
|
@ -866,3 +888,327 @@ diff --git a/s_truncf.cpp b/s_truncf.cpp
|
|||
truncf(float x)
|
||||
{
|
||||
int32_t i0,j0;
|
||||
--- a/e_acosf.cpp 2022-12-11 21:15:50.058431053 -0500
|
||||
+++ b/e_acosf.cpp_new 2022-12-11 21:13:10.532515637 -0500
|
||||
@@ -12,15 +12,14 @@
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
-#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
static const float
|
||||
one = 1.0000000000e+00, /* 0x3F800000 */
|
||||
pi = 3.1415925026e+00, /* 0x40490fda */
|
||||
pio2_hi = 1.5707962513e+00; /* 0x3fc90fda */
|
||||
static volatile float
|
||||
--- a/e_asinf.cpp 2022-12-11 21:15:50.486437124 -0500
|
||||
+++ b/e_asinf.cpp_new 2022-12-11 21:13:07.876498396 -0500
|
||||
@@ -12,15 +12,14 @@
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
-#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
static const float
|
||||
one = 1.0000000000e+00, /* 0x3F800000 */
|
||||
huge = 1.000e+30,
|
||||
/* coefficient for R(x^2) */
|
||||
pS0 = 1.6666586697e-01,
|
||||
--- a/e_expf.cpp 2022-12-11 21:15:51.250447960 -0500
|
||||
+++ b/e_expf.cpp_new 2022-12-11 21:13:05.212481099 -0500
|
||||
@@ -14,15 +14,14 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <float.h>
|
||||
|
||||
-#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
static const float
|
||||
one = 1.0,
|
||||
halF[2] = {0.5,-0.5,},
|
||||
o_threshold= 8.8721679688e+01, /* 0x42b17180 */
|
||||
u_threshold= -1.0397208405e+02, /* 0xc2cff1b5 */
|
||||
--- a/e_logf.cpp 2022-12-11 21:15:51.978458278 -0500
|
||||
+++ b/e_logf.cpp_new 2022-12-11 21:13:02.644464418 -0500
|
||||
@@ -12,15 +12,14 @@
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
-#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
static const float
|
||||
ln2_hi = 6.9313812256e-01, /* 0x3f317180 */
|
||||
ln2_lo = 9.0580006145e-06, /* 0x3717f7d1 */
|
||||
two25 = 3.355443200e+07, /* 0x4c000000 */
|
||||
/* |(log(1+s)-log(1-s))/s - Lg(s)| < 2**-34.24 (~[-4.95e-11, 4.97e-11]). */
|
||||
--- a/e_powf.cpp 2022-12-11 21:15:52.242462016 -0500
|
||||
+++ b/e_powf.cpp_new 2022-12-11 21:13:00.164448306 -0500
|
||||
@@ -12,15 +12,14 @@
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
-#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
static const float
|
||||
bp[] = {1.0, 1.5,},
|
||||
dp_h[] = { 0.0, 5.84960938e-01,}, /* 0x3f15c000 */
|
||||
dp_l[] = { 0.0, 1.56322085e-06,}, /* 0x35d1cfdc */
|
||||
zero = 0.0,
|
||||
--- a/e_rem_pio2f.cpp 2022-12-11 21:15:52.626467454 -0500
|
||||
+++ b/e_rem_pio2f.cpp_new 2022-12-11 21:12:57.300429693 -0500
|
||||
@@ -22,15 +22,14 @@
|
||||
* return the remainder of x rem pi/2 in *y
|
||||
* use double precision for everything except passing x
|
||||
* use __kernel_rem_pio2() for large x
|
||||
*/
|
||||
|
||||
#include <float.h>
|
||||
|
||||
-#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
/*
|
||||
* invpio2: 53 bits of 2/pi
|
||||
* pio2_1: first 25 bits of pi/2
|
||||
* pio2_1t: pi/2 - pio2_1
|
||||
*/
|
||||
--- a/e_sqrtf.cpp 2022-12-11 21:15:52.922471645 -0500
|
||||
+++ b/e_sqrtf.cpp_new 2022-12-11 21:12:54.596412113 -0500
|
||||
@@ -13,15 +13,14 @@
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
-#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
#ifdef USE_BUILTIN_SQRTF
|
||||
float
|
||||
__ieee754_sqrtf(float x)
|
||||
{
|
||||
return (__builtin_sqrtf(x));
|
||||
--- a/k_cosf.cpp 2022-12-11 21:15:53.178475268 -0500
|
||||
+++ b/k_cosf.cpp_new 2022-12-11 21:12:52.012395309 -0500
|
||||
@@ -15,15 +15,14 @@
|
||||
*/
|
||||
|
||||
#ifndef INLINE_KERNEL_COSDF
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
#endif
|
||||
|
||||
-#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
/* |cos(x) - c(x)| < 2**-34.1 (~[-5.37e-11, 5.295e-11]). */
|
||||
static const double
|
||||
one = 1.0,
|
||||
C0 = -0x1ffffffd0c5e81.0p-54, /* -0.499999997251031003120 */
|
||||
C1 = 0x155553e1053a42.0p-57, /* 0.0416666233237390631894 */
|
||||
--- a/k_expf.cpp 2022-12-11 21:15:53.434478888 -0500
|
||||
+++ b/k_expf.cpp_new 2022-12-11 21:12:49.012375792 -0500
|
||||
@@ -27,15 +27,14 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <complex.h>
|
||||
|
||||
-#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
static const uint32_t k = 235; /* constant for reduction */
|
||||
static const float kln2 = 162.88958740F; /* k * ln2 */
|
||||
|
||||
/*
|
||||
* See k_exp.c for details.
|
||||
--- a/k_sinf.cpp 2022-12-11 21:15:53.946486130 -0500
|
||||
+++ b/k_sinf.cpp_new 2022-12-11 21:12:46.020356322 -0500
|
||||
@@ -15,15 +15,14 @@
|
||||
*/
|
||||
|
||||
#ifndef INLINE_KERNEL_SINDF
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
#endif
|
||||
|
||||
-#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
/* |sin(x)/x - s(x)| < 2**-37.5 (~[-4.89e-12, 4.824e-12]). */
|
||||
static const double
|
||||
S1 = -0x15555554cbac77.0p-55, /* -0.166666666416265235595 */
|
||||
S2 = 0x111110896efbb2.0p-59, /* 0.0083333293858894631756 */
|
||||
S3 = -0x1a00f9e2cae774.0p-65, /* -0.000198393348360966317347 */
|
||||
--- a/k_tanf.cpp 2022-12-11 21:15:54.254490484 -0500
|
||||
+++ b/k_tanf.cpp_new 2022-12-11 21:12:42.972336479 -0500
|
||||
@@ -14,15 +14,14 @@
|
||||
*/
|
||||
|
||||
#ifndef INLINE_KERNEL_TANDF
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
#endif
|
||||
|
||||
-#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
/* |tan(x)/x - t(x)| < 2**-25.5 (~[-2e-08, 2e-08]). */
|
||||
static const double
|
||||
T[] = {
|
||||
0x15554d3418c99f.0p-54, /* 0.333331395030791399758 */
|
||||
0x1112fd38999f72.0p-55, /* 0.133392002712976742718 */
|
||||
--- a/s_atanf.cpp 2022-12-11 21:15:54.670496364 -0500
|
||||
+++ b/s_atanf.cpp_new 2022-12-11 21:12:39.940316733 -0500
|
||||
@@ -12,15 +12,14 @@
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
-#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
static const float atanhi[] = {
|
||||
4.6364760399e-01, /* atan(0.5)hi 0x3eed6338 */
|
||||
7.8539812565e-01, /* atan(1.0)hi 0x3f490fda */
|
||||
9.8279368877e-01, /* atan(1.5)hi 0x3f7b985e */
|
||||
1.5707962513e+00, /* atan(inf)hi 0x3fc90fda */
|
||||
--- a/s_cosf.cpp 2022-12-11 21:15:55.494508001 -0500
|
||||
+++ b/s_cosf.cpp_new 2022-12-11 21:12:37.396300160 -0500
|
||||
@@ -15,15 +15,14 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <float.h>
|
||||
|
||||
-#include "math.h"
|
||||
#define INLINE_KERNEL_COSDF
|
||||
#define INLINE_KERNEL_SINDF
|
||||
#define INLINE_REM_PIO2F
|
||||
#include "math_private.h"
|
||||
#include "e_rem_pio2f.c"
|
||||
#include "k_cosf.c"
|
||||
#include "k_sinf.c"
|
||||
--- a/s_exp2.cpp 2022-12-11 21:15:55.790512181 -0500
|
||||
+++ b/s_exp2.cpp_new 2022-12-11 21:12:34.476281131 -0500
|
||||
@@ -27,15 +27,14 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <float.h>
|
||||
|
||||
-#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
#define TBLBITS 8
|
||||
#define TBLSIZE (1 << TBLBITS)
|
||||
|
||||
static const double
|
||||
redux = 0x1.8p52 / TBLSIZE,
|
||||
--- a/s_exp2f.cpp 2022-12-11 21:15:55.926514101 -0500
|
||||
+++ b/s_exp2f.cpp_new 2022-12-11 21:12:30.644256149 -0500
|
||||
@@ -27,15 +27,14 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <float.h>
|
||||
|
||||
-#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
#define TBLBITS 4
|
||||
#define TBLSIZE (1 << TBLBITS)
|
||||
|
||||
static const float
|
||||
redux = 0x1.8p23f / TBLSIZE,
|
||||
--- a/s_fabsf.cpp 2022-12-11 21:15:56.202517995 -0500
|
||||
+++ b/s_fabsf.cpp_new 2022-12-11 21:12:27.244233973 -0500
|
||||
@@ -16,15 +16,14 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* fabsf(x) returns the absolute value of x.
|
||||
*/
|
||||
|
||||
-#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
float
|
||||
fabsf(float x)
|
||||
{
|
||||
u_int32_t ix;
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
--- a/s_sinf.cpp 2022-12-11 21:15:57.618537960 -0500
|
||||
+++ b/s_sinf.cpp_new 2022-12-11 21:12:24.684217270 -0500
|
||||
@@ -15,15 +15,14 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <float.h>
|
||||
|
||||
-#include "math.h"
|
||||
#define INLINE_KERNEL_COSDF
|
||||
#define INLINE_KERNEL_SINDF
|
||||
#define INLINE_REM_PIO2F
|
||||
#include "math_private.h"
|
||||
#include "e_rem_pio2f.c"
|
||||
#include "k_cosf.c"
|
||||
#include "k_sinf.c"
|
||||
--- a/s_tanf.cpp 2022-12-11 21:15:57.930542357 -0500
|
||||
+++ b/s_tanf.cpp_new 2022-12-11 21:12:20.420189437 -0500
|
||||
@@ -15,15 +15,14 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <float.h>
|
||||
|
||||
-#include "math.h"
|
||||
#define INLINE_KERNEL_TANDF
|
||||
#define INLINE_REM_PIO2F
|
||||
#include "math_private.h"
|
||||
#include "e_rem_pio2f.c"
|
||||
#include "k_tanf.c"
|
||||
|
||||
/* Small multiples of pi/2 rounded to double precision. */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
diff --git a/math_private.h b/math_private.h
|
||||
--- a/math_private.h
|
||||
+++ b/math_private.h
|
||||
@@ -867,16 +867,53 @@ irintl(long double x)
|
||||
@@ -867,16 +867,67 @@ irintl(long double x)
|
||||
#define __ieee754_j1f j1f
|
||||
#define __ieee754_y0f y0f
|
||||
#define __ieee754_y1f y1f
|
||||
|
@ -11,22 +11,34 @@ diff --git a/math_private.h b/math_private.h
|
|||
#define __ieee754_scalbf scalbf
|
||||
|
||||
+#define acos fdlibm::acos
|
||||
+#define acosf fdlibm::acosf
|
||||
+#define asin fdlibm::asin
|
||||
+#define asinf fdlibm::asinf
|
||||
+#define atan fdlibm::atan
|
||||
+#define atanf fdlibm::atanf
|
||||
+#define atan2 fdlibm::atan2
|
||||
+#define cos fdlibm::cos
|
||||
+#define cosf fdlibm::cosf
|
||||
+#define sin fdlibm::sin
|
||||
+#define sinf fdlibm::sinf
|
||||
+#define tan fdlibm::tan
|
||||
+#define tanf fdlibm::tanf
|
||||
+#define cosh fdlibm::cosh
|
||||
+#define sinh fdlibm::sinh
|
||||
+#define tanh fdlibm::tanh
|
||||
+#define exp fdlibm::exp
|
||||
+#define expf fdlibm::expf
|
||||
+#define exp2 fdlibm::exp2
|
||||
+#define exp2f fdlibm::exp2f
|
||||
+#define log fdlibm::log
|
||||
+#define logf fdlibm::logf
|
||||
+#define log10 fdlibm::log10
|
||||
+#define pow fdlibm::pow
|
||||
+#define powf fdlibm::powf
|
||||
+#define ceil fdlibm::ceil
|
||||
+#define ceilf fdlibm::ceilf
|
||||
+#define fabs fdlibm::fabs
|
||||
+#define fabsf fdlibm::fabsf
|
||||
+#define floor fdlibm::floor
|
||||
+#define acosh fdlibm::acosh
|
||||
+#define asinh fdlibm::asinh
|
||||
|
@ -39,6 +51,7 @@ diff --git a/math_private.h b/math_private.h
|
|||
+#define scalb fdlibm::scalb
|
||||
+#define copysign fdlibm::copysign
|
||||
+#define scalbn fdlibm::scalbn
|
||||
+#define scalbnf fdlibm::scalbnf
|
||||
+#define trunc fdlibm::trunc
|
||||
+#define truncf fdlibm::truncf
|
||||
+#define floorf fdlibm::floorf
|
||||
|
@ -46,6 +59,7 @@ diff --git a/math_private.h b/math_private.h
|
|||
+#define nearbyintf fdlibm::nearbyintf
|
||||
+#define rint fdlibm::rint
|
||||
+#define rintf fdlibm::rintf
|
||||
+#define sqrtf fdlibm::sqrtf
|
||||
+
|
||||
/* fdlibm kernel function */
|
||||
int __kernel_rem_pio2(double*,double*,int,int,int);
|
||||
|
|
|
@ -431,3 +431,29 @@ diff --git a/s_trunc.cpp b/s_trunc.cpp
|
|||
-#if LDBL_MANT_DIG == 53
|
||||
-__weak_reference(trunc, truncl);
|
||||
-#endif
|
||||
--- a/s_exp2.cpp 2022-12-11 21:20:40.290068458 -0500
|
||||
+++ b/s_exp2.cpp_new 2022-12-11 21:20:57.490259247 -0500
|
||||
@@ -389,10 +389,6 @@
|
||||
return (r * 2.0 * 0x1p1023);
|
||||
return (r * twopk);
|
||||
} else {
|
||||
return (r * twopkp1000 * twom1000);
|
||||
}
|
||||
}
|
||||
-
|
||||
-#if (LDBL_MANT_DIG == 53)
|
||||
-__weak_reference(exp2, exp2l);
|
||||
-#endif
|
||||
--- a/s_scalbnf.cpp
|
||||
+++ b/s_scalbnf.cpp
|
||||
@@ -32,10 +34,8 @@
|
||||
if (n < -126)
|
||||
n = -126;
|
||||
}
|
||||
}
|
||||
u.i = (uint32_t)(0x7f+n)<<23;
|
||||
x = y * u.f;
|
||||
return x;
|
||||
}
|
||||
-
|
||||
-__strong_reference(scalbnf, ldexpf);
|
||||
|
|
|
@ -978,3 +978,385 @@ diff --git a/s_truncf.cpp b/s_truncf.cpp
|
|||
* Bit twiddling.
|
||||
* Exception:
|
||||
* Inexact flag raised if x not equal to truncf(x).
|
||||
--- a/e_acosf.cpp 2022-12-11 21:20:40.290068458 -0500
|
||||
+++ b/e_acosf.cpp_new 2022-12-11 21:23:31.863880382 -0500
|
||||
@@ -9,16 +9,16 @@
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
-#include <sys/cdefs.h>
|
||||
-__FBSDID("$FreeBSD$");
|
||||
+//#include <sys/cdefs.h>
|
||||
+//__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
static const float
|
||||
one = 1.0000000000e+00, /* 0x3F800000 */
|
||||
pi = 3.1415925026e+00, /* 0x40490fda */
|
||||
pio2_hi = 1.5707962513e+00; /* 0x3fc90fda */
|
||||
--- a/e_asinf.cpp 2022-12-11 21:20:40.290068458 -0500
|
||||
+++ b/e_asinf.cpp_new 2022-12-11 21:23:31.875880502 -0500
|
||||
@@ -9,16 +9,16 @@
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
-#include <sys/cdefs.h>
|
||||
-__FBSDID("$FreeBSD$");
|
||||
+//#include <sys/cdefs.h>
|
||||
+//__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
static const float
|
||||
one = 1.0000000000e+00, /* 0x3F800000 */
|
||||
huge = 1.000e+30,
|
||||
/* coefficient for R(x^2) */
|
||||
--- a/e_expf.cpp 2022-12-11 21:20:40.290068458 -0500
|
||||
+++ b/e_expf.cpp_new 2022-12-11 21:23:31.895880703 -0500
|
||||
@@ -9,16 +9,16 @@
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
-#include <sys/cdefs.h>
|
||||
-__FBSDID("$FreeBSD$");
|
||||
+//#include <sys/cdefs.h>
|
||||
+//__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <float.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
static const float
|
||||
one = 1.0,
|
||||
--- a/e_logf.cpp 2022-12-11 21:20:40.290068458 -0500
|
||||
+++ b/e_logf.cpp_new 2022-12-11 21:23:31.935881104 -0500
|
||||
@@ -9,16 +9,16 @@
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
-#include <sys/cdefs.h>
|
||||
-__FBSDID("$FreeBSD$");
|
||||
+//#include <sys/cdefs.h>
|
||||
+//__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
static const float
|
||||
ln2_hi = 6.9313812256e-01, /* 0x3f317180 */
|
||||
ln2_lo = 9.0580006145e-06, /* 0x3717f7d1 */
|
||||
two25 = 3.355443200e+07, /* 0x4c000000 */
|
||||
--- a/e_powf.cpp 2022-12-11 21:20:40.290068458 -0500
|
||||
+++ b/e_powf.cpp_new 2022-12-11 21:23:31.971881465 -0500
|
||||
@@ -9,16 +9,16 @@
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
-#include <sys/cdefs.h>
|
||||
-__FBSDID("$FreeBSD$");
|
||||
+//#include <sys/cdefs.h>
|
||||
+//__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
static const float
|
||||
bp[] = {1.0, 1.5,},
|
||||
dp_h[] = { 0.0, 5.84960938e-01,}, /* 0x3f15c000 */
|
||||
dp_l[] = { 0.0, 1.56322085e-06,}, /* 0x35d1cfdc */
|
||||
--- a/e_rem_pio2f.cpp 2022-12-11 21:20:40.290068458 -0500
|
||||
+++ b/e_rem_pio2f.cpp_new 2022-12-11 21:23:32.015881905 -0500
|
||||
@@ -10,16 +10,16 @@
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
-#include <sys/cdefs.h>
|
||||
-__FBSDID("$FreeBSD$");
|
||||
+//#include <sys/cdefs.h>
|
||||
+//__FBSDID("$FreeBSD$");
|
||||
|
||||
/* __ieee754_rem_pio2f(x,y)
|
||||
*
|
||||
* return the remainder of x rem pi/2 in *y
|
||||
* use double precision for everything except passing x
|
||||
* use __kernel_rem_pio2() for large x
|
||||
*/
|
||||
--- b/k_cosf.cpp 2022-12-11 21:20:40.290068458 -0500
|
||||
+++ b/k_cosf.cpp_new 2022-12-11 21:23:32.051882266 -0500
|
||||
@@ -11,16 +11,16 @@
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef INLINE_KERNEL_COSDF
|
||||
-#include <sys/cdefs.h>
|
||||
-__FBSDID("$FreeBSD$");
|
||||
+//#include <sys/cdefs.h>
|
||||
+//__FBSDID("$FreeBSD$");
|
||||
#endif
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
/* |cos(x) - c(x)| < 2**-34.1 (~[-5.37e-11, 5.295e-11]). */
|
||||
static const double
|
||||
one = 1.0,
|
||||
--- b/k_expf.cpp 2022-12-11 21:20:40.290068458 -0500
|
||||
+++ b/k_expf.cpp_new 2022-12-11 21:23:32.087882627 -0500
|
||||
@@ -22,16 +22,16 @@
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
-#include <sys/cdefs.h>
|
||||
-__FBSDID("$FreeBSD$");
|
||||
+//#include <sys/cdefs.h>
|
||||
+//__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <complex.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
static const uint32_t k = 235; /* constant for reduction */
|
||||
static const float kln2 = 162.88958740F; /* k * ln2 */
|
||||
--- b/k_sinf.cpp 2022-12-11 21:20:40.290068458 -0500
|
||||
+++ b/k_sinf.cpp_new 2022-12-11 21:23:32.119882948 -0500
|
||||
@@ -11,16 +11,16 @@
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef INLINE_KERNEL_SINDF
|
||||
-#include <sys/cdefs.h>
|
||||
-__FBSDID("$FreeBSD$");
|
||||
+//#include <sys/cdefs.h>
|
||||
+//__FBSDID("$FreeBSD$");
|
||||
#endif
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
/* |sin(x)/x - s(x)| < 2**-37.5 (~[-4.89e-12, 4.824e-12]). */
|
||||
static const double
|
||||
S1 = -0x15555554cbac77.0p-55, /* -0.166666666416265235595 */
|
||||
--- b/k_tanf.cpp 2022-12-11 21:20:40.290068458 -0500
|
||||
+++ b/k_tanf.cpp_new 2022-12-11 21:23:32.155883308 -0500
|
||||
@@ -10,16 +10,16 @@
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef INLINE_KERNEL_TANDF
|
||||
-#include <sys/cdefs.h>
|
||||
-__FBSDID("$FreeBSD$");
|
||||
+//#include <sys/cdefs.h>
|
||||
+//__FBSDID("$FreeBSD$");
|
||||
#endif
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
/* |tan(x)/x - t(x)| < 2**-25.5 (~[-2e-08, 2e-08]). */
|
||||
static const double
|
||||
T[] = {
|
||||
--- a/s_atanf.cpp 2022-12-11 21:20:40.290068458 -0500
|
||||
+++ b/s_atanf.cpp_new 2022-12-11 21:23:32.199883749 -0500
|
||||
@@ -9,16 +9,16 @@
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
-#include <sys/cdefs.h>
|
||||
-__FBSDID("$FreeBSD$");
|
||||
+//#include <sys/cdefs.h>
|
||||
+//__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
static const float atanhi[] = {
|
||||
4.6364760399e-01, /* atan(0.5)hi 0x3eed6338 */
|
||||
7.8539812565e-01, /* atan(1.0)hi 0x3f490fda */
|
||||
9.8279368877e-01, /* atan(1.5)hi 0x3f7b985e */
|
||||
--- a/s_cosf.cpp 2022-12-11 21:20:40.290068458 -0500
|
||||
+++ b/s_cosf.cpp_new 2022-12-11 21:23:32.235884110 -0500
|
||||
@@ -10,16 +10,16 @@
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
-#include <sys/cdefs.h>
|
||||
-__FBSDID("$FreeBSD$");
|
||||
+//#include <sys/cdefs.h>
|
||||
+//__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <float.h>
|
||||
|
||||
#define INLINE_KERNEL_COSDF
|
||||
#define INLINE_KERNEL_SINDF
|
||||
#define INLINE_REM_PIO2F
|
||||
#include "math_private.h"
|
||||
--- a/s_exp2.cpp 2022-12-11 21:20:40.290068458 -0500
|
||||
+++ b/s_exp2.cpp_new 2022-12-11 21:23:32.275884511 -0500
|
||||
@@ -22,16 +22,16 @@
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
-#include <sys/cdefs.h>
|
||||
-__FBSDID("$FreeBSD$");
|
||||
+//#include <sys/cdefs.h>
|
||||
+//__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <float.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
#define TBLBITS 8
|
||||
#define TBLSIZE (1 << TBLBITS)
|
||||
--- a/s_exp2f.cpp 2022-12-11 21:20:40.290068458 -0500
|
||||
+++ b/s_exp2f.cpp_new 2022-12-11 21:23:32.311884872 -0500
|
||||
@@ -22,16 +22,16 @@
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
-#include <sys/cdefs.h>
|
||||
-__FBSDID("$FreeBSD$");
|
||||
+//#include <sys/cdefs.h>
|
||||
+//__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <float.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
#define TBLBITS 4
|
||||
#define TBLSIZE (1 << TBLBITS)
|
||||
--- a/s_fabsf.cpp 2022-12-11 21:20:40.290068458 -0500
|
||||
+++ b/s_fabsf.cpp_new 2022-12-11 21:23:32.347885233 -0500
|
||||
@@ -9,16 +9,16 @@
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
-#include <sys/cdefs.h>
|
||||
-__FBSDID("$FreeBSD$");
|
||||
+//#include <sys/cdefs.h>
|
||||
+//__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* fabsf(x) returns the absolute value of x.
|
||||
*/
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
--- a/s_sinf.cpp 2022-12-11 21:20:40.290068458 -0500
|
||||
+++ b/s_sinf.cpp_new 2022-12-11 21:23:32.383885594 -0500
|
||||
@@ -10,16 +10,16 @@
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
-#include <sys/cdefs.h>
|
||||
-__FBSDID("$FreeBSD$");
|
||||
+//#include <sys/cdefs.h>
|
||||
+//__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <float.h>
|
||||
|
||||
#define INLINE_KERNEL_COSDF
|
||||
#define INLINE_KERNEL_SINDF
|
||||
#define INLINE_REM_PIO2F
|
||||
#include "math_private.h"
|
||||
--- a/s_tanf.cpp 2022-12-11 21:20:40.290068458 -0500
|
||||
+++ b/s_tanf.cpp_new 2022-12-11 21:23:32.419885954 -0500
|
||||
@@ -10,16 +10,16 @@
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
-#include <sys/cdefs.h>
|
||||
-__FBSDID("$FreeBSD$");
|
||||
+//#include <sys/cdefs.h>
|
||||
+//__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <float.h>
|
||||
|
||||
#define INLINE_KERNEL_TANDF
|
||||
#define INLINE_REM_PIO2F
|
||||
#include "math_private.h"
|
||||
#include "e_rem_pio2f.c"
|
||||
--- a/e_sqrtf.cpp 2022-12-13 14:30:13.113415455 -0500
|
||||
+++ b/e_sqrtf.cpp 2022-12-13 14:13:15.302434550 -0500
|
||||
@@ -8,19 +8,19 @@
|
||||
*
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
-#ifndef lint
|
||||
-static char rcsid[] = "$FreeBSD$";
|
||||
-#endif
|
||||
+//#ifndef lint
|
||||
+//static char rcsid[] = "$FreeBSD$";
|
||||
+//#endif
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
#ifdef USE_BUILTIN_SQRTF
|
||||
float
|
||||
__ieee754_sqrtf(float x)
|
||||
{
|
||||
return (__builtin_sqrtf(x));
|
||||
|
|
|
@ -54,3 +54,54 @@ diff --git a/k_exp.cpp b/k_exp.cpp
|
|||
- return (CMPLX(c * exp_x * scale1 * scale2,
|
||||
- s * exp_x * scale1 * scale2));
|
||||
-}
|
||||
--- a/k_expf.cpp 2022-12-13 14:39:11.791594163 -0500
|
||||
+++ b/k_expf.cpp 2022-12-13 14:39:18.631622916 -0500
|
||||
@@ -24,18 +24,16 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
//#include <sys/cdefs.h>
|
||||
//__FBSDID("$FreeBSD$");
|
||||
|
||||
-#include <complex.h>
|
||||
-
|
||||
#include "math_private.h"
|
||||
|
||||
static const uint32_t k = 235; /* constant for reduction */
|
||||
static const float kln2 = 162.88958740F; /* k * ln2 */
|
||||
|
||||
/*
|
||||
* See k_exp.c for details.
|
||||
*
|
||||
@@ -61,29 +59,8 @@
|
||||
float exp_x, scale;
|
||||
int ex_expt;
|
||||
|
||||
exp_x = __frexp_expf(x, &ex_expt);
|
||||
expt += ex_expt;
|
||||
SET_FLOAT_WORD(scale, (0x7f + expt) << 23);
|
||||
return (exp_x * scale);
|
||||
}
|
||||
-
|
||||
-float complex
|
||||
-__ldexp_cexpf(float complex z, int expt)
|
||||
-{
|
||||
- float c, exp_x, s, scale1, scale2, x, y;
|
||||
- int ex_expt, half_expt;
|
||||
-
|
||||
- x = crealf(z);
|
||||
- y = cimagf(z);
|
||||
- exp_x = __frexp_expf(x, &ex_expt);
|
||||
- expt += ex_expt;
|
||||
-
|
||||
- half_expt = expt / 2;
|
||||
- SET_FLOAT_WORD(scale1, (0x7f + half_expt) << 23);
|
||||
- half_expt = expt - half_expt;
|
||||
- SET_FLOAT_WORD(scale2, (0x7f + half_expt) << 23);
|
||||
-
|
||||
- sincosf(y, &s, &c);
|
||||
- return (CMPLXF(c * exp_x * scale1 * scale2,
|
||||
- s * exp_x * scale1 * scale2));
|
||||
-}
|
||||
|
|
|
@ -45,3 +45,24 @@ diff --git a/s_expm1.cpp b/s_expm1.cpp
|
|||
SET_HIGH_WORD(t,0x3ff00000 - (0x200000>>k)); /* t=1-2^-k */
|
||||
y = t-(e-x);
|
||||
y = y*twopk;
|
||||
--- a/s_exp2.cpp 2022-12-11 21:26:36.045643147 -0500
|
||||
+++ b/s_exp2.cpp_new 2022-12-11 21:28:42.058769925 -0500
|
||||
@@ -381,14 +381,16 @@
|
||||
INSERT_WORDS(twopk, 0x3ff00000 + k, 0);
|
||||
else
|
||||
INSERT_WORDS(twopkp1000, 0x3ff00000 + k + (1000 << 20), 0);
|
||||
r = t + t * z * (P1 + z * (P2 + z * (P3 + z * (P4 + z * P5))));
|
||||
|
||||
/* Scale by 2**(k>>20). */
|
||||
if(k >= -(1021 << 20)) {
|
||||
- if (k == 1024 << 20)
|
||||
- return (r * 2.0 * 0x1p1023);
|
||||
+ if (k == 1024 << 20) {
|
||||
+ double const_0x1p1023 = pow(2, 1023);
|
||||
+ return (r * 2.0 * const_0x1p1023);
|
||||
+ }
|
||||
return (r * twopk);
|
||||
} else {
|
||||
return (r * twopkp1000 * twom1000);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -251,3 +251,39 @@ diff --git a/s_asinh.cpp b/s_asinh.cpp
|
|||
}
|
||||
if(hx>0) return w; else return -w;
|
||||
}
|
||||
--- a/e_asinf.cpp 2022-12-13 14:45:17.953154257 -0500
|
||||
+++ b/e_asinf.cpp 2022-12-13 14:45:03.425091710 -0500
|
||||
@@ -11,16 +11,18 @@
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
//#include <sys/cdefs.h>
|
||||
//__FBSDID("$FreeBSD$");
|
||||
|
||||
+#include <cmath>
|
||||
+
|
||||
#include "math_private.h"
|
||||
|
||||
static const float
|
||||
one = 1.0000000000e+00, /* 0x3F800000 */
|
||||
huge = 1.000e+30,
|
||||
/* coefficient for R(x^2) */
|
||||
pS0 = 1.6666586697e-01,
|
||||
pS1 = -4.2743422091e-02,
|
||||
@@ -52,13 +54,13 @@
|
||||
w = p/q;
|
||||
return x+x*w;
|
||||
}
|
||||
/* 1> |x|>= 0.5 */
|
||||
w = one-fabsf(x);
|
||||
t = w*(float)0.5;
|
||||
p = t*(pS0+t*(pS1+t*pS2));
|
||||
q = one+t*qS1;
|
||||
- s = sqrt(t);
|
||||
+ s = std::sqrt(t);
|
||||
w = p/q;
|
||||
t = pio2-2.0*(s+s*w);
|
||||
if(hx>0) return t; else return -t;
|
||||
}
|
||||
|
|
|
@ -109,3 +109,118 @@ diff --git a/s_tan.cpp b/s_tan.cpp
|
|||
int32_t n, ix;
|
||||
|
||||
/* High word of x. */
|
||||
--- a/s_cosf.cpp 2022-12-11 21:26:36.041643110 -0500
|
||||
+++ b/s_cosf.cpp 2022-12-11 21:34:08.197486828 -0500
|
||||
@@ -18,19 +18,19 @@
|
||||
//__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <float.h>
|
||||
|
||||
#define INLINE_KERNEL_COSDF
|
||||
#define INLINE_KERNEL_SINDF
|
||||
#define INLINE_REM_PIO2F
|
||||
#include "math_private.h"
|
||||
-#include "e_rem_pio2f.c"
|
||||
-#include "k_cosf.c"
|
||||
-#include "k_sinf.c"
|
||||
+#include "e_rem_pio2f.cpp"
|
||||
+#include "k_cosf.cpp"
|
||||
+#include "k_sinf.cpp"
|
||||
|
||||
/* Small multiples of pi/2 rounded to double precision. */
|
||||
static const double
|
||||
c1pio2 = 1*M_PI_2, /* 0x3FF921FB, 0x54442D18 */
|
||||
c2pio2 = 2*M_PI_2, /* 0x400921FB, 0x54442D18 */
|
||||
c3pio2 = 3*M_PI_2, /* 0x4012D97C, 0x7F3321D2 */
|
||||
c4pio2 = 4*M_PI_2; /* 0x401921FB, 0x54442D18 */
|
||||
|
||||
--- a/s_sinf.cpp 2022-12-11 21:26:36.045643147 -0500
|
||||
+++ b/s_sinf.cpp 2022-12-11 21:33:52.741362926 -0500
|
||||
@@ -18,19 +18,19 @@
|
||||
//__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <float.h>
|
||||
|
||||
#define INLINE_KERNEL_COSDF
|
||||
#define INLINE_KERNEL_SINDF
|
||||
#define INLINE_REM_PIO2F
|
||||
#include "math_private.h"
|
||||
-#include "e_rem_pio2f.c"
|
||||
-#include "k_cosf.c"
|
||||
-#include "k_sinf.c"
|
||||
+#include "e_rem_pio2f.cpp"
|
||||
+#include "k_cosf.cpp"
|
||||
+#include "k_sinf.cpp"
|
||||
|
||||
/* Small multiples of pi/2 rounded to double precision. */
|
||||
static const double
|
||||
s1pio2 = 1*M_PI_2, /* 0x3FF921FB, 0x54442D18 */
|
||||
s2pio2 = 2*M_PI_2, /* 0x400921FB, 0x54442D18 */
|
||||
s3pio2 = 3*M_PI_2, /* 0x4012D97C, 0x7F3321D2 */
|
||||
s4pio2 = 4*M_PI_2; /* 0x401921FB, 0x54442D18 */
|
||||
|
||||
--- a/s_tanf.cpp 2022-12-11 21:26:36.045643147 -0500
|
||||
+++ b/s_tanf.cpp 2022-12-11 21:33:45.269302886 -0500
|
||||
@@ -17,18 +17,18 @@
|
||||
//#include <sys/cdefs.h>
|
||||
//__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <float.h>
|
||||
|
||||
#define INLINE_KERNEL_TANDF
|
||||
#define INLINE_REM_PIO2F
|
||||
#include "math_private.h"
|
||||
-#include "e_rem_pio2f.c"
|
||||
-#include "k_tanf.c"
|
||||
+#include "e_rem_pio2f.cpp"
|
||||
+#include "k_tanf.cpp"
|
||||
|
||||
/* Small multiples of pi/2 rounded to double precision. */
|
||||
static const double
|
||||
t1pio2 = 1*M_PI_2, /* 0x3FF921FB, 0x54442D18 */
|
||||
t2pio2 = 2*M_PI_2, /* 0x400921FB, 0x54442D18 */
|
||||
t3pio2 = 3*M_PI_2, /* 0x4012D97C, 0x7F3321D2 */
|
||||
t4pio2 = 4*M_PI_2; /* 0x401921FB, 0x54442D18 */
|
||||
|
||||
--- a/e_rem_pio2f.cpp 2022-12-13 14:50:12.582776365 -0500
|
||||
+++ b/e_rem_pio2f.cpp 2022-12-13 14:51:05.003200166 -0500
|
||||
@@ -35,17 +35,17 @@
|
||||
*/
|
||||
|
||||
static const double
|
||||
invpio2 = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */
|
||||
pio2_1 = 1.57079631090164184570e+00, /* 0x3FF921FB, 0x50000000 */
|
||||
pio2_1t = 1.58932547735281966916e-08; /* 0x3E5110b4, 0x611A6263 */
|
||||
|
||||
#ifdef INLINE_REM_PIO2F
|
||||
-static __inline __always_inline
|
||||
+static inline
|
||||
#endif
|
||||
int
|
||||
__ieee754_rem_pio2f(float x, double *y)
|
||||
{
|
||||
double w,r,fn;
|
||||
double tx[1],ty[1];
|
||||
float z;
|
||||
int32_t e0,n,ix,hx;
|
||||
--- a/e_powf.cpp
|
||||
+++ b/e_powf.cpp
|
||||
@@ -11,16 +11,18 @@
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
//#include <sys/cdefs.h>
|
||||
//__FBSDID("$FreeBSD$");
|
||||
|
||||
+#include "s_scalbnf.cpp"
|
||||
+
|
||||
#include "math_private.h"
|
||||
|
||||
static const float
|
||||
bp[] = {1.0, 1.5,},
|
||||
dp_h[] = { 0.0, 5.84960938e-01,}, /* 0x3f15c000 */
|
||||
dp_l[] = { 0.0, 1.56322085e-06,}, /* 0x35d1cfdc */
|
||||
zero = 0.0,
|
||||
half = 0.5,
|
||||
|
|
|
@ -19,3 +19,48 @@ diff --git a/math_private.h b/math_private.h
|
|||
* ix1 = *((1-n0)+(int*)&x); * low word of x *
|
||||
* to dig two 32 bit words out of the 64 bit IEEE floating point
|
||||
* value. That is non-ANSI, and, moreover, the gcc instruction
|
||||
diff --git a/e_rem_pio2f.cpp b/e_rem_pio2f.cpp
|
||||
--- a/e_rem_pio2f.cpp
|
||||
+++ b/e_rem_pio2f.cpp
|
||||
@@ -49,17 +49,17 @@ int
|
||||
double tx[1],ty[1];
|
||||
float z;
|
||||
int32_t e0,n,ix,hx;
|
||||
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
ix = hx&0x7fffffff;
|
||||
/* 33+53 bit pi is good enough for medium size */
|
||||
if(ix<0x4dc90fdb) { /* |x| ~< 2^28*(pi/2), medium size */
|
||||
- fn = rnint((float_t)x*invpio2);
|
||||
+ fn = rnint((float)x*invpio2);
|
||||
n = irint(fn);
|
||||
r = x-fn*pio2_1;
|
||||
w = fn*pio2_1t;
|
||||
*y = r-w;
|
||||
return n;
|
||||
}
|
||||
/*
|
||||
* all other (large) arguments
|
||||
diff --git a/s_scalbnf.cpp b/s_scalbnf.cpp
|
||||
--- a/s_scalbnf.cpp
|
||||
+++ b/s_scalbnf.cpp
|
||||
@@ -7,18 +7,18 @@
|
||||
* for all contributors to musl.
|
||||
*/
|
||||
#include <stdint.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
float scalbnf(float x, int n)
|
||||
{
|
||||
union {float f; uint32_t i;} u;
|
||||
- float_t y = x;
|
||||
+ float y = x;
|
||||
|
||||
if (n > 127) {
|
||||
y *= 0x1p127f;
|
||||
n -= 127;
|
||||
if (n > 127) {
|
||||
y *= 0x1p127f;
|
||||
n -= 127;
|
||||
if (n > 127)
|
||||
|
|
Загрузка…
Ссылка в новой задаче