Source code

Revision control

Copy as Markdown

Other Tools

"math.h" is still included in e_hypotf.cpp for fabsl() and
in e_log10f.cpp for float_t.
diff --git a/e_acos.cpp b/e_acos.cpp
--- a/e_acos.cpp
+++ b/e_acos.cpp
@@ -35,17 +35,16 @@ __FBSDID("$FreeBSD$");
* if x is NaN, return x itself;
* if |x|>1, return NaN with invalid signal.
*
* Function needed: sqrt
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
static const double
one= 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */
pio2_hi = 1.57079632679489655800e+00; /* 0x3FF921FB, 0x54442D18 */
static volatile double
pio2_lo = 6.12323399573676603587e-17; /* 0x3C91A626, 0x33145C07 */
diff --git a/e_acosh.cpp b/e_acosh.cpp
--- a/e_acosh.cpp
+++ b/e_acosh.cpp
@@ -26,17 +26,16 @@ __FBSDID("$FreeBSD$");
*
* Special cases:
* acosh(x) is NaN with signal if x<1.
* acosh(NaN) is NaN without signal.
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
static const double
one = 1.0,
ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */
double
__ieee754_acosh(double x)
diff --git a/e_asin.cpp b/e_asin.cpp
--- a/e_asin.cpp
+++ b/e_asin.cpp
@@ -41,17 +41,16 @@ __FBSDID("$FreeBSD$");
* Special cases:
* if x is NaN, return x itself;
* if |x|>1, return NaN with invalid signal.
*
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
static const double
one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
huge = 1.000e+300,
pio2_hi = 1.57079632679489655800e+00, /* 0x3FF921FB, 0x54442D18 */
pio2_lo = 6.12323399573676603587e-17, /* 0x3C91A626, 0x33145C07 */
pio4_hi = 7.85398163397448278999e-01, /* 0x3FE921FB, 0x54442D18 */
diff --git a/e_atan2.cpp b/e_atan2.cpp
--- a/e_atan2.cpp
+++ b/e_atan2.cpp
@@ -39,17 +39,16 @@ __FBSDID("$FreeBSD$");
* The hexadecimal values are the intended ones for the following
* constants. The decimal values may be used, provided that the
* compiler will convert from decimal to binary accurately enough
* to produce the hexadecimal values shown.
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
static volatile double
tiny = 1.0e-300;
static const double
zero = 0.0,
pi_o_4 = 7.8539816339744827900E-01, /* 0x3FE921FB, 0x54442D18 */
pi_o_2 = 1.5707963267948965580E+00, /* 0x3FF921FB, 0x54442D18 */
diff --git a/e_atanh.cpp b/e_atanh.cpp
--- a/e_atanh.cpp
+++ b/e_atanh.cpp
@@ -30,17 +30,16 @@ __FBSDID("$FreeBSD$");
* atanh(x) is NaN if |x| > 1 with signal;
* atanh(NaN) is that NaN with no signal;
* atanh(+-1) is +-INF with signal.
*
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
static const double one = 1.0, huge = 1e300;
static const double zero = 0.0;
double
__ieee754_atanh(double x)
{
diff --git a/e_cosh.cpp b/e_cosh.cpp
--- a/e_cosh.cpp
+++ b/e_cosh.cpp
@@ -32,17 +32,16 @@ __FBSDID("$FreeBSD$");
*
* Special cases:
* cosh(x) is |x| if x is +INF, -INF, or NaN.
* only cosh(0)=1 is exact for finite x.
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
static const double one = 1.0, half=0.5, huge = 1.0e300;
double
__ieee754_cosh(double x)
{
double t,w;
diff --git a/e_exp.cpp b/e_exp.cpp
--- a/e_exp.cpp
+++ b/e_exp.cpp
@@ -73,17 +73,16 @@ __FBSDID("$FreeBSD$");
* The hexadecimal values are the intended ones for the following
* constants. The decimal values may be used, provided that the
* compiler will convert from decimal to binary accurately enough
* to produce the hexadecimal values shown.
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
static const double
one = 1.0,
halF[2] = {0.5,-0.5,},
o_threshold= 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */
u_threshold= -7.45133219101941108420e+02, /* 0xc0874910, 0xD52D3051 */
ln2HI[2] ={ 6.93147180369123816490e-01, /* 0x3fe62e42, 0xfee00000 */
diff --git a/e_hypot.cpp b/e_hypot.cpp
--- a/e_hypot.cpp
+++ b/e_hypot.cpp
@@ -43,17 +43,16 @@ __FBSDID("$FreeBSD$");
*
* Accuracy:
* hypot(x,y) returns sqrt(x^2+y^2) with error less
* than 1 ulps (units in the last place)
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
double
__ieee754_hypot(double x, double y)
{
double a,b,t1,t2,y1,y2,w;
int32_t j,k,ha,hb;
diff --git a/e_log.cpp b/e_log.cpp
--- a/e_log.cpp
+++ b/e_log.cpp
@@ -62,17 +62,16 @@ __FBSDID("$FreeBSD$");
* The hexadecimal values are the intended ones for the following
* constants. The decimal values may be used, provided that the
* compiler will convert from decimal to binary accurately enough
* to produce the hexadecimal values shown.
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
static const double
ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */
ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */
two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */
Lg1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */
Lg2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */
diff --git a/e_log10.cpp b/e_log10.cpp
--- a/e_log10.cpp
+++ b/e_log10.cpp
@@ -19,17 +19,16 @@ __FBSDID("$FreeBSD$");
* comments.
*
* log10(x) = (f - 0.5*f*f + k_log1p(f)) / ln10 + k * log10(2)
* in not-quite-routine extra precision.
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
#include "k_log.h"
static const double
two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
ivln10hi = 4.34294481878168880939e-01, /* 0x3fdbcb7b, 0x15200000 */
ivln10lo = 2.50829467116452752298e-11, /* 0x3dbb9438, 0xca9aadd5 */
log10_2hi = 3.01029995663611771306e-01, /* 0x3FD34413, 0x509F6000 */
diff --git a/e_log2.cpp b/e_log2.cpp
--- a/e_log2.cpp
+++ b/e_log2.cpp
@@ -21,17 +21,16 @@ __FBSDID("$FreeBSD$");
* This reduces x to {k, 1+f} exactly as in e_log.c, then calls the kernel,
* then does the combining and scaling steps
* log2(x) = (f - 0.5*f*f + k_log1p(f)) / ln2 + k
* in not-quite-routine extra precision.
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
#include "k_log.h"
static const double
two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
ivln2hi = 1.44269504072144627571e+00, /* 0x3ff71547, 0x65200000 */
ivln2lo = 1.67517131648865118353e-10; /* 0x3de705fc, 0x2eefa200 */
diff --git a/e_pow.cpp b/e_pow.cpp
--- a/e_pow.cpp
+++ b/e_pow.cpp
@@ -53,17 +53,16 @@ __FBSDID("$FreeBSD$");
* Constants :
* The hexadecimal values are the intended ones for the following
* constants. The decimal values may be used, provided that the
* compiler will convert from decimal to binary accurately enough
* to produce the hexadecimal values shown.
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
static const double
bp[] = {1.0, 1.5,},
dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */
dp_l[] = { 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */
zero = 0.0,
half = 0.5,
diff --git a/e_rem_pio2.cpp b/e_rem_pio2.cpp
--- a/e_rem_pio2.cpp
+++ b/e_rem_pio2.cpp
@@ -19,17 +19,16 @@ __FBSDID("$FreeBSD$");
/* __ieee754_rem_pio2(x,y)
*
* return the remainder of x rem pi/2 in y[0]+y[1]
* use __kernel_rem_pio2()
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
/*
* invpio2: 53 bits of 2/pi
* pio2_1: first 33 bit of pi/2
* pio2_1t: pi/2 - pio2_1
* pio2_2: second 33 bit of pi/2
* pio2_2t: pi/2 - (pio2_1+pio2_2)
diff --git a/e_sinh.cpp b/e_sinh.cpp
--- a/e_sinh.cpp
+++ b/e_sinh.cpp
@@ -29,17 +29,16 @@ __FBSDID("$FreeBSD$");
*
* Special cases:
* sinh(x) is |x| if x is +INF, -INF, or NaN.
* only sinh(0)=0 is exact for finite x.
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
static const double one = 1.0, shuge = 1.0e307;
double
__ieee754_sinh(double x)
{
double t,h;
diff --git a/k_cos.cpp b/k_cos.cpp
--- a/k_cos.cpp
+++ b/k_cos.cpp
@@ -48,17 +48,16 @@ __FBSDID("$FreeBSD$");
* and tmp having the same precision as x. If they have extra
* precision due to compiler bugs, then the extra precision is
* only good provided it is retained in all terms of the final
* expression for cos(). Retention happens in all cases tested
* under FreeBSD, so don't pessimize things by forcibly clipping
* any extra precision in w.
*/
-#include "math.h"
#include "math_private.h"
static const double
one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
C1 = 4.16666666666666019037e-02, /* 0x3FA55555, 0x5555554C */
C2 = -1.38888888888741095749e-03, /* 0xBF56C16C, 0x16C15177 */
C3 = 2.48015872894767294178e-05, /* 0x3EFA01A0, 0x19CB1590 */
C4 = -2.75573143513906633035e-07, /* 0xBE927E4F, 0x809C52AD */
diff --git a/k_exp.cpp b/k_exp.cpp
--- a/k_exp.cpp
+++ b/k_exp.cpp
@@ -26,17 +26,16 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <complex.h>
-#include "math.h"
#include "math_private.h"
static const uint32_t k = 1799; /* constant for reduction */
static const double kln2 = 1246.97177782734161156; /* k * ln2 */
/*
* Compute exp(x), scaled to avoid spurious overflow. An exponent is
* returned separately in 'expt'.
diff --git a/k_rem_pio2.cpp b/k_rem_pio2.cpp
--- a/k_rem_pio2.cpp
+++ b/k_rem_pio2.cpp
@@ -126,17 +126,16 @@ __FBSDID("$FreeBSD$");
* The hexadecimal values are the intended ones for the following
* constants. The decimal values may be used, provided that the
* compiler will convert from decimal to binary accurately enough
* to produce the hexadecimal values shown.
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
static const int init_jk[] = {3,4,4,6}; /* initial value for jk */
/*
* Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi
*
* integer array, contains the (24*i)-th to (24*i+23)-th
diff --git a/k_sin.cpp b/k_sin.cpp
--- a/k_sin.cpp
+++ b/k_sin.cpp
@@ -39,17 +39,16 @@ __FBSDID("$FreeBSD$");
* ~ sin(x) + (1-x*x/2)*y
* For better accuracy, let
* 3 2 2 2 2
* r = x *(S2+x *(S3+x *(S4+x *(S5+x *S6))))
* then 3 2
* sin(x) = x + (S1*x + (x *(r-y/2)+y))
*/
-#include "math.h"
#include "math_private.h"
static const double
half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */
S1 = -1.66666666666666324348e-01, /* 0xBFC55555, 0x55555549 */
S2 = 8.33333333332248946124e-03, /* 0x3F811111, 0x1110F8A6 */
S3 = -1.98412698298579493134e-04, /* 0xBF2A01A0, 0x19C161D5 */
S4 = 2.75573137070700676789e-06, /* 0x3EC71DE3, 0x57B1FE7D */
diff --git a/k_tan.cpp b/k_tan.cpp
--- a/k_tan.cpp
+++ b/k_tan.cpp
@@ -44,17 +44,16 @@ __FBSDID("$FreeBSD$");
* 3 2
* tan(x+y) = x + (T1*x + (x *(r+y)+y))
*
* 4. For x in [0.67434,pi/4], let y = pi/4 - x, then
* tan(x) = tan(pi/4-y) = (1-tan(y))/(1+tan(y))
* = 1 - 2*(tan(y) - (tan(y)^2)/(1+tan(y)))
*/
-#include "math.h"
#include "math_private.h"
static const double xxx[] = {
3.33333333333334091986e-01, /* 3FD55555, 55555563 */
1.33333333333201242699e-01, /* 3FC11111, 1110FE7A */
5.39682539762260521377e-02, /* 3FABA1BA, 1BB341FE */
2.18694882948595424599e-02, /* 3F9664F4, 8406D637 */
8.86323982359930005737e-03, /* 3F8226E3, E96E8493 */
3.59207910759131235356e-03, /* 3F6D6D22, C9560328 */
diff --git a/math_private.h b/math_private.h
--- a/math_private.h
+++ b/math_private.h
@@ -15,16 +15,18 @@
*/
#ifndef _MATH_PRIVATE_H_
#define _MATH_PRIVATE_H_
#include <sys/types.h>
#include <machine/endian.h>
+#include "fdlibm.h"
+
/*
* The original fdlibm code used statements like:
* n0 = ((*(int*)&one)>>29)^1; * index of high word *
* ix0 = *(n0+(int*)&x); * high word of x *
* 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
* scheduler gets it wrong. We instead use the following macros.
diff --git a/s_asinh.cpp b/s_asinh.cpp
--- a/s_asinh.cpp
+++ b/s_asinh.cpp
@@ -21,17 +21,16 @@ __FBSDID("$FreeBSD$");
* asinh(x) := x if 1+x*x=1,
* := sign(x)*(log(x)+ln2)) for large |x|, else
* := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x|>2, else
* := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2)))
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
static const double
one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
ln2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */
huge= 1.00000000000000000000e+300;
double
diff --git a/s_atan.cpp b/s_atan.cpp
--- a/s_atan.cpp
+++ b/s_atan.cpp
@@ -30,17 +30,16 @@ __FBSDID("$FreeBSD$");
* The hexadecimal values are the intended ones for the following
* constants. The decimal values may be used, provided that the
* compiler will convert from decimal to binary accurately enough
* to produce the hexadecimal values shown.
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
static const double atanhi[] = {
4.63647609000806093515e-01, /* atan(0.5)hi 0x3FDDAC67, 0x0561BB4F */
7.85398163397448278999e-01, /* atan(1.0)hi 0x3FE921FB, 0x54442D18 */
9.82793723247329054082e-01, /* atan(1.5)hi 0x3FEF730B, 0xD281F69B */
1.57079632679489655800e+00, /* atan(inf)hi 0x3FF921FB, 0x54442D18 */
};
diff --git a/s_cbrt.cpp b/s_cbrt.cpp
--- a/s_cbrt.cpp
+++ b/s_cbrt.cpp
@@ -11,17 +11,16 @@
*
* Optimized by Bruce D. Evans.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <float.h>
-#include "math.h"
#include "math_private.h"
/* cbrt(x)
* Return cube root of x
*/
static const u_int32_t
B1 = 715094163, /* B1 = (1023-1023/3-0.03306235651)*2**20 */
B2 = 696219795; /* B2 = (1023-1023/3-54/3-0.03306235651)*2**20 */
diff --git a/s_ceil.cpp b/s_ceil.cpp
--- a/s_ceil.cpp
+++ b/s_ceil.cpp
@@ -19,17 +19,16 @@ __FBSDID("$FreeBSD$");
* Method:
* Bit twiddling.
* Exception:
* Inexact flag raised if x not equal to ceil(x).
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
static const double huge = 1.0e300;
double
ceil(double x)
{
int32_t i0,i1,j0;
diff --git a/s_ceilf.cpp b/s_ceilf.cpp
--- a/s_ceilf.cpp
+++ b/s_ceilf.cpp
@@ -11,17 +11,16 @@
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "math.h"
#include "math_private.h"
static const float huge = 1.0e30;
float
ceilf(float x)
{
int32_t i0,j0;
diff --git a/s_copysign.cpp b/s_copysign.cpp
--- a/s_copysign.cpp
+++ b/s_copysign.cpp
@@ -14,17 +14,16 @@
__FBSDID("$FreeBSD$");
/*
* copysign(double x, double y)
* copysign(x,y) returns a value with the magnitude of x and
* with the sign bit of y.
*/
-#include "math.h"
#include "math_private.h"
double
copysign(double x, double y)
{
u_int32_t hx,hy;
GET_HIGH_WORD(hx,x);
GET_HIGH_WORD(hy,y);
diff --git a/s_cos.cpp b/s_cos.cpp
--- a/s_cos.cpp
+++ b/s_cos.cpp
@@ -41,17 +41,16 @@ __FBSDID("$FreeBSD$");
* trig(NaN) is that NaN;
*
* Accuracy:
* TRIG(x) returns trig(x) nearly rounded
*/
#include <float.h>
-#include "math.h"
#define INLINE_REM_PIO2
#include "math_private.h"
#include "e_rem_pio2.c"
double
cos(double x)
{
double y[2],z=0.0;
diff --git a/s_expm1.cpp b/s_expm1.cpp
--- a/s_expm1.cpp
+++ b/s_expm1.cpp
@@ -105,17 +105,16 @@ __FBSDID("$FreeBSD$");
* The hexadecimal values are the intended ones for the following
* constants. The decimal values may be used, provided that the
* compiler will convert from decimal to binary accurately enough
* to produce the hexadecimal values shown.
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
static const double
one = 1.0,
tiny = 1.0e-300,
o_threshold = 7.09782712893383973096e+02,/* 0x40862E42, 0xFEFA39EF */
ln2_hi = 6.93147180369123816490e-01,/* 0x3fe62e42, 0xfee00000 */
ln2_lo = 1.90821492927058770002e-10,/* 0x3dea39ef, 0x35793c76 */
diff --git a/s_fabs.cpp b/s_fabs.cpp
--- a/s_fabs.cpp
+++ b/s_fabs.cpp
@@ -12,17 +12,16 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
/*
* fabs(x) returns the absolute value of x.
*/
-#include "math.h"
#include "math_private.h"
double
fabs(double x)
{
u_int32_t high;
GET_HIGH_WORD(high,x);
SET_HIGH_WORD(x,high&0x7fffffff);
diff --git a/s_floor.cpp b/s_floor.cpp
--- a/s_floor.cpp
+++ b/s_floor.cpp
@@ -19,17 +19,16 @@ __FBSDID("$FreeBSD$");
* Method:
* Bit twiddling.
* Exception:
* Inexact flag raised if x not equal to floor(x).
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
static const double huge = 1.0e300;
double
floor(double x)
{
int32_t i0,i1,j0;
diff --git a/s_floorf.cpp b/s_floorf.cpp
--- a/s_floorf.cpp
+++ b/s_floorf.cpp
@@ -20,17 +20,16 @@ __FBSDID("$FreeBSD$");
* floorf(x)
* Return x rounded toward -inf to integral value
* Method:
* Bit twiddling.
* Exception:
* Inexact flag raised if x not equal to floorf(x).
*/
-#include "math.h"
#include "math_private.h"
static const float huge = 1.0e30;
float
floorf(float x)
{
int32_t i0,j0;
diff --git a/s_log1p.cpp b/s_log1p.cpp
--- a/s_log1p.cpp
+++ b/s_log1p.cpp
@@ -75,17 +75,16 @@ __FBSDID("$FreeBSD$");
* if(u==1.0) return x ; else
* return log(u)*(x/(u-1.0));
*
* See HP-15C Advanced Functions Handbook, p.193.
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
static const double
ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */
ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */
two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */
Lp1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */
Lp2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */
diff --git a/s_nearbyint.cpp b/s_nearbyint.cpp
--- a/s_nearbyint.cpp
+++ b/s_nearbyint.cpp
@@ -25,17 +25,18 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <fenv.h>
-#include <math.h>
+
+#include "math_private.h"
/*
* We save and restore the floating-point environment to avoid raising
* an inexact exception. We can get away with using fesetenv()
* instead of feclearexcept()/feupdateenv() to restore the environment
* because the only exception defined for rint() is overflow, and
* rounding can't overflow as long as emax >= p.
*
diff --git a/s_rint.cpp b/s_rint.cpp
--- a/s_rint.cpp
+++ b/s_rint.cpp
@@ -20,17 +20,16 @@ __FBSDID("$FreeBSD$");
* Method:
* Using floating addition.
* Exception:
* Inexact flag raised if x not equal to rint(x).
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
static const double
TWO52[2]={
4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
-4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
};
diff --git a/s_rintf.cpp b/s_rintf.cpp
--- a/s_rintf.cpp
+++ b/s_rintf.cpp
@@ -14,17 +14,16 @@
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <float.h>
#include <stdint.h>
-#include "math.h"
#include "math_private.h"
static const float
TWO23[2]={
8.3886080000e+06, /* 0x4b000000 */
-8.3886080000e+06, /* 0xcb000000 */
};
diff --git a/s_scalbn.cpp b/s_scalbn.cpp
--- a/s_scalbn.cpp
+++ b/s_scalbn.cpp
@@ -2,19 +2,20 @@
* Copyright (c) 2005-2020 Rich Felker, et al.
*
* SPDX-License-Identifier: MIT
*
* for all contributors to musl.
*/
#include <float.h>
-#include <math.h>
#include <stdint.h>
+#include "math_private.h"
+
double scalbn(double x, int n)
{
union {double f; uint64_t i;} u;
double_t y = x;
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
*
* 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
@@ -41,17 +41,16 @@ __FBSDID("$FreeBSD$");
* trig(NaN) is that NaN;
*
* Accuracy:
* TRIG(x) returns trig(x) nearly rounded
*/
#include <float.h>
-#include "math.h"
#define INLINE_REM_PIO2
#include "math_private.h"
#include "e_rem_pio2.c"
double
sin(double x)
{
double y[2],z=0.0;
diff --git a/s_tan.cpp b/s_tan.cpp
--- a/s_tan.cpp
+++ b/s_tan.cpp
@@ -40,17 +40,16 @@ __FBSDID("$FreeBSD$");
* trig(NaN) is that NaN;
*
* Accuracy:
* TRIG(x) returns trig(x) nearly rounded
*/
#include <float.h>
-#include "math.h"
#define INLINE_REM_PIO2
#include "math_private.h"
#include "e_rem_pio2.c"
double
tan(double x)
{
double y[2],z=0.0;
diff --git a/s_tanh.cpp b/s_tanh.cpp
--- a/s_tanh.cpp
+++ b/s_tanh.cpp
@@ -34,17 +34,16 @@ __FBSDID("$FreeBSD$");
*
* Special cases:
* tanh(NaN) is NaN;
* only tanh(0)=0 is exact for finite argument.
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
static const volatile double tiny = 1.0e-300;
static const double one = 1.0, two = 2.0, huge = 1.0e300;
double
tanh(double x)
{
diff --git a/s_trunc.cpp b/s_trunc.cpp
--- a/s_trunc.cpp
+++ b/s_trunc.cpp
@@ -19,17 +19,16 @@ __FBSDID("$FreeBSD$");
* Method:
* Bit twiddling.
* Exception:
* Inexact flag raised if x not equal to trunc(x).
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
static const double huge = 1.0e300;
double
trunc(double x)
{
int32_t i0,i1,j0;
diff --git a/s_truncf.cpp b/s_truncf.cpp
--- a/s_truncf.cpp
+++ b/s_truncf.cpp
@@ -17,17 +17,16 @@ __FBSDID("$FreeBSD$");
* truncf(x)
* Return x rounded toward 0 to integral value
* Method:
* Bit twiddling.
* Exception:
* Inexact flag raised if x not equal to truncf(x).
*/
-#include "math.h"
#include "math_private.h"
static const float huge = 1.0e30F;
float
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. */