Bug 933257 - Part 2: Add patches for fdlibm. r=jwalden

This commit is contained in:
Tooru Fujisawa 2016-03-13 02:16:14 +09:00
parent 29db49ab36
commit fa373353b6
16 changed files with 3329 additions and 0 deletions

View File

@ -0,0 +1,513 @@
# HG changeset patch
# User Tooru Fujisawa <arai_a@mac.com>
# Date 1452137427 -32400
# Thu Jan 07 12:30:27 2016 +0900
# Node ID b928f0090a041b6eb0c3f8e97f038233f3fda55b
# Parent 571d45daf6735e585cf1d09190628f94e1bce81f
Bug 933257 - Part 2.1: Remove unused declarations from fdlibm.h.
diff --git a/modules/fdlibm/src/fdlibm.h b/modules/fdlibm/src/fdlibm.h
--- a/modules/fdlibm/src/fdlibm.h
+++ b/modules/fdlibm/src/fdlibm.h
@@ -12,496 +12,48 @@
/*
* from: @(#)fdlibm.h 5.1 93/09/24
* $FreeBSD$
*/
#ifndef _MATH_H_
#define _MATH_H_
-#include <sys/cdefs.h>
-#include <sys/_types.h>
-#include <machine/_limits.h>
-
-/*
- * ANSI/POSIX
- */
-extern const union __infinity_un {
- unsigned char __uc[8];
- double __ud;
-} __infinity;
-
-extern const union __nan_un {
- unsigned char __uc[sizeof(float)];
- float __uf;
-} __nan;
-
-#if __GNUC_PREREQ__(3, 3) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
-#define __MATH_BUILTIN_CONSTANTS
-#endif
-
-#if __GNUC_PREREQ__(3, 0) && !defined(__INTEL_COMPILER)
-#define __MATH_BUILTIN_RELOPS
-#endif
-
-#ifdef __MATH_BUILTIN_CONSTANTS
-#define HUGE_VAL __builtin_huge_val()
-#else
-#define HUGE_VAL (__infinity.__ud)
-#endif
-
-#if __ISO_C_VISIBLE >= 1999
-#define FP_ILOGB0 (-__INT_MAX)
-#define FP_ILOGBNAN __INT_MAX
-
-#ifdef __MATH_BUILTIN_CONSTANTS
-#define HUGE_VALF __builtin_huge_valf()
-#define HUGE_VALL __builtin_huge_vall()
-#define INFINITY __builtin_inff()
-#define NAN __builtin_nanf("")
-#else
-#define HUGE_VALF (float)HUGE_VAL
-#define HUGE_VALL (long double)HUGE_VAL
-#define INFINITY HUGE_VALF
-#define NAN (__nan.__uf)
-#endif /* __MATH_BUILTIN_CONSTANTS */
-
-#define MATH_ERRNO 1
-#define MATH_ERREXCEPT 2
-#define math_errhandling MATH_ERREXCEPT
-
-#define FP_FAST_FMAF 1
-
-/* Symbolic constants to classify floating point numbers. */
-#define FP_INFINITE 0x01
-#define FP_NAN 0x02
-#define FP_NORMAL 0x04
-#define FP_SUBNORMAL 0x08
-#define FP_ZERO 0x10
-
-#if (__STDC_VERSION__ >= 201112L && defined(__clang__)) || \
- __has_extension(c_generic_selections)
-#define __fp_type_select(x, f, d, ld) _Generic((x), \
- float: f(x), \
- double: d(x), \
- long double: ld(x), \
- volatile float: f(x), \
- volatile double: d(x), \
- volatile long double: ld(x), \
- volatile const float: f(x), \
- volatile const double: d(x), \
- volatile const long double: ld(x), \
- const float: f(x), \
- const double: d(x), \
- const long double: ld(x))
-#elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus)
-#define __fp_type_select(x, f, d, ld) __builtin_choose_expr( \
- __builtin_types_compatible_p(__typeof(x), long double), ld(x), \
- __builtin_choose_expr( \
- __builtin_types_compatible_p(__typeof(x), double), d(x), \
- __builtin_choose_expr( \
- __builtin_types_compatible_p(__typeof(x), float), f(x), (void)0)))
-#else
-#define __fp_type_select(x, f, d, ld) \
- ((sizeof(x) == sizeof(float)) ? f(x) \
- : (sizeof(x) == sizeof(double)) ? d(x) \
- : ld(x))
-#endif
-
-#define fpclassify(x) \
- __fp_type_select(x, __fpclassifyf, __fpclassifyd, __fpclassifyl)
-#define isfinite(x) __fp_type_select(x, __isfinitef, __isfinite, __isfinitel)
-#define isinf(x) __fp_type_select(x, __isinff, __isinf, __isinfl)
-#define isnan(x) \
- __fp_type_select(x, __inline_isnanf, __inline_isnan, __inline_isnanl)
-#define isnormal(x) __fp_type_select(x, __isnormalf, __isnormal, __isnormall)
-
-#ifdef __MATH_BUILTIN_RELOPS
-#define isgreater(x, y) __builtin_isgreater((x), (y))
-#define isgreaterequal(x, y) __builtin_isgreaterequal((x), (y))
-#define isless(x, y) __builtin_isless((x), (y))
-#define islessequal(x, y) __builtin_islessequal((x), (y))
-#define islessgreater(x, y) __builtin_islessgreater((x), (y))
-#define isunordered(x, y) __builtin_isunordered((x), (y))
-#else
-#define isgreater(x, y) (!isunordered((x), (y)) && (x) > (y))
-#define isgreaterequal(x, y) (!isunordered((x), (y)) && (x) >= (y))
-#define isless(x, y) (!isunordered((x), (y)) && (x) < (y))
-#define islessequal(x, y) (!isunordered((x), (y)) && (x) <= (y))
-#define islessgreater(x, y) (!isunordered((x), (y)) && \
- ((x) > (y) || (y) > (x)))
-#define isunordered(x, y) (isnan(x) || isnan(y))
-#endif /* __MATH_BUILTIN_RELOPS */
-
-#define signbit(x) __fp_type_select(x, __signbitf, __signbit, __signbitl)
-
-typedef __double_t double_t;
-typedef __float_t float_t;
-#endif /* __ISO_C_VISIBLE >= 1999 */
-
-/*
- * XOPEN/SVID
- */
-#if __BSD_VISIBLE || __XSI_VISIBLE
-#define M_E 2.7182818284590452354 /* e */
-#define M_LOG2E 1.4426950408889634074 /* log 2e */
-#define M_LOG10E 0.43429448190325182765 /* log 10e */
-#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_4 0.78539816339744830962 /* pi/4 */
-#define M_1_PI 0.31830988618379067154 /* 1/pi */
-#define M_2_PI 0.63661977236758134308 /* 2/pi */
-#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
-#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
-#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
-
-#define MAXFLOAT ((float)3.40282346638528860e+38)
-extern int signgam;
-#endif /* __BSD_VISIBLE || __XSI_VISIBLE */
-
-#if __BSD_VISIBLE
-#if 0
-/* Old value from 4.4BSD-Lite math.h; this is probably better. */
-#define HUGE HUGE_VAL
-#else
-#define HUGE MAXFLOAT
-#endif
-#endif /* __BSD_VISIBLE */
-
-/*
- * Most of these functions depend on the rounding mode and have the side
- * effect of raising floating-point exceptions, so they are not declared
- * as __pure2. In C99, FENV_ACCESS affects the purity of these functions.
- */
-__BEGIN_DECLS
-/*
- * ANSI/POSIX
- */
-int __fpclassifyd(double) __pure2;
-int __fpclassifyf(float) __pure2;
-int __fpclassifyl(long double) __pure2;
-int __isfinitef(float) __pure2;
-int __isfinite(double) __pure2;
-int __isfinitel(long double) __pure2;
-int __isinff(float) __pure2;
-int __isinf(double) __pure2;
-int __isinfl(long double) __pure2;
-int __isnormalf(float) __pure2;
-int __isnormal(double) __pure2;
-int __isnormall(long double) __pure2;
-int __signbit(double) __pure2;
-int __signbitf(float) __pure2;
-int __signbitl(long double) __pure2;
-
-static __inline int
-__inline_isnan(__const double __x)
-{
-
- return (__x != __x);
-}
-
-static __inline int
-__inline_isnanf(__const float __x)
-{
-
- return (__x != __x);
-}
-
-static __inline int
-__inline_isnanl(__const long double __x)
-{
-
- return (__x != __x);
-}
-
-/*
- * Version 2 of the Single UNIX Specification (UNIX98) defined isnan() and
- * isinf() as functions taking double. C99, and the subsequent POSIX revisions
- * (SUSv3, POSIX.1-2001, define it as a macro that accepts any real floating
- * point type. If we are targeting SUSv2 and C99 or C11 (or C++11) then we
- * expose the newer definition, assuming that the language spec takes
- * precedence over the operating system interface spec.
- */
-#if __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600 && __ISO_C_VISIBLE < 1999
-#undef isinf
-#undef isnan
-int isinf(double);
-int isnan(double);
-#endif
-
double acos(double);
double asin(double);
double atan(double);
double atan2(double, double);
double cos(double);
double sin(double);
double tan(double);
double cosh(double);
double sinh(double);
double tanh(double);
double exp(double);
-double frexp(double, int *); /* fundamentally !__pure2 */
-double ldexp(double, int);
double log(double);
double log10(double);
-double modf(double, double *); /* fundamentally !__pure2 */
double pow(double, double);
double sqrt(double);
double ceil(double);
-double fabs(double) __pure2;
+float ceilf(float);
+double fabs(double);
double floor(double);
-double fmod(double, double);
-/*
- * These functions are not in C90.
- */
-#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE
double acosh(double);
double asinh(double);
double atanh(double);
double cbrt(double);
-double erf(double);
-double erfc(double);
-double exp2(double);
double expm1(double);
-double fma(double, double, double);
double hypot(double, double);
-int ilogb(double) __pure2;
-double lgamma(double);
-long long llrint(double);
-long long llround(double);
double log1p(double);
double log2(double);
-double logb(double);
-long lrint(double);
-long lround(double);
-double nan(const char *) __pure2;
-double nextafter(double, double);
-double remainder(double, double);
-double remquo(double, double, int *);
-double rint(double);
-#endif /* __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE */
-#if __BSD_VISIBLE || __XSI_VISIBLE
-double j0(double);
-double j1(double);
-double jn(int, double);
-double y0(double);
-double y1(double);
-double yn(int, double);
+double copysign(double, double);
+double scalbn(double, int);
+double trunc(double);
-#if __XSI_VISIBLE <= 500 || __BSD_VISIBLE
-double gamma(double);
-#endif
-
-#if __XSI_VISIBLE <= 600 || __BSD_VISIBLE
-double scalb(double, double);
-#endif
-#endif /* __BSD_VISIBLE || __XSI_VISIBLE */
-
-#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999
-double copysign(double, double) __pure2;
-double fdim(double, double);
-double fmax(double, double) __pure2;
-double fmin(double, double) __pure2;
-double nearbyint(double);
-double round(double);
-double scalbln(double, long);
-double scalbn(double, int);
-double tgamma(double);
-double trunc(double);
-#endif
-
-/*
- * BSD math library entry points
- */
-#if __BSD_VISIBLE
-double drem(double, double);
-int finite(double) __pure2;
-int isnanf(float) __pure2;
-
-/*
- * Reentrant version of gamma & lgamma; passes signgam back by reference
- * as the second argument; user must allocate space for signgam.
- */
-double gamma_r(double, int *);
-double lgamma_r(double, int *);
-
-/*
- * IEEE Test Vector
- */
-double significand(double);
-#endif /* __BSD_VISIBLE */
-
-/* float versions of ANSI/POSIX functions */
-#if __ISO_C_VISIBLE >= 1999
-float acosf(float);
-float asinf(float);
-float atanf(float);
-float atan2f(float, 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 expm1f(float);
-float frexpf(float, int *); /* fundamentally !__pure2 */
-int ilogbf(float) __pure2;
-float ldexpf(float, int);
-float log10f(float);
-float log1pf(float);
-float log2f(float);
-float logf(float);
-float modff(float, float *); /* fundamentally !__pure2 */
-
-float powf(float, float);
-float sqrtf(float);
-
-float ceilf(float);
-float fabsf(float) __pure2;
float floorf(float);
-float fmodf(float, float);
-float roundf(float);
-
-float erff(float);
-float erfcf(float);
-float hypotf(float, float);
-float lgammaf(float);
-float tgammaf(float);
-
-float acoshf(float);
-float asinhf(float);
-float atanhf(float);
-float cbrtf(float);
-float logbf(float);
-float copysignf(float, float) __pure2;
-long long llrintf(float);
-long long llroundf(float);
-long lrintf(float);
-long lroundf(float);
-float nanf(const char *) __pure2;
-float nearbyintf(float);
-float nextafterf(float, float);
-float remainderf(float, float);
-float remquof(float, float, int *);
-float rintf(float);
-float scalblnf(float, long);
-float scalbnf(float, int);
-float truncf(float);
-
-float fdimf(float, float);
-float fmaf(float, float, float);
-float fmaxf(float, float) __pure2;
-float fminf(float, float) __pure2;
-#endif
-
-/*
- * float versions of BSD math library entry points
- */
-#if __BSD_VISIBLE
-float dremf(float, float);
-int finitef(float) __pure2;
-float gammaf(float);
-float j0f(float);
-float j1f(float);
-float jnf(int, float);
-float scalbf(float, float);
-float y0f(float);
-float y1f(float);
-float ynf(int, float);
-
-/*
- * Float versions of reentrant version of gamma & lgamma; passes
- * signgam back by reference as the second argument; user must
- * allocate space for signgam.
- */
-float gammaf_r(float, int *);
-float lgammaf_r(float, int *);
-
-/*
- * float version of IEEE Test Vector
- */
-float significandf(float);
-#endif /* __BSD_VISIBLE */
-
-/*
- * long double versions of ISO/POSIX math functions
- */
-#if __ISO_C_VISIBLE >= 1999
-long double acoshl(long double);
-long double acosl(long double);
-long double asinhl(long double);
-long double asinl(long double);
-long double atan2l(long double, long double);
-long double atanhl(long double);
-long double atanl(long double);
-long double cbrtl(long double);
-long double ceill(long double);
-long double copysignl(long double, long double) __pure2;
-long double coshl(long double);
-long double cosl(long double);
-long double erfcl(long double);
-long double erfl(long double);
-long double exp2l(long double);
-long double expl(long double);
-long double expm1l(long double);
-long double fabsl(long double) __pure2;
-long double fdiml(long double, long double);
-long double floorl(long double);
-long double fmal(long double, long double, long double);
-long double fmaxl(long double, long double) __pure2;
-long double fminl(long double, long double) __pure2;
-long double fmodl(long double, long double);
-long double frexpl(long double value, int *); /* fundamentally !__pure2 */
-long double hypotl(long double, long double);
-int ilogbl(long double) __pure2;
-long double ldexpl(long double, int);
-long double lgammal(long double);
-long long llrintl(long double);
-long long llroundl(long double);
-long double log10l(long double);
-long double log1pl(long double);
-long double log2l(long double);
-long double logbl(long double);
-long double logl(long double);
-long lrintl(long double);
-long lroundl(long double);
-long double modfl(long double, long double *); /* fundamentally !__pure2 */
-long double nanl(const char *) __pure2;
-long double nearbyintl(long double);
-long double nextafterl(long double, long double);
-double nexttoward(double, long double);
-float nexttowardf(float, long double);
-long double nexttowardl(long double, long double);
-long double powl(long double, long double);
-long double remainderl(long double, long double);
-long double remquol(long double, long double, int *);
-long double rintl(long double);
-long double roundl(long double);
-long double scalblnl(long double, long);
-long double scalbnl(long double, int);
-long double sinhl(long double);
-long double sinl(long double);
-long double sqrtl(long double);
-long double tanhl(long double);
-long double tanl(long double);
-long double tgammal(long double);
-long double truncl(long double);
-#endif /* __ISO_C_VISIBLE >= 1999 */
-
-#if __BSD_VISIBLE
-long double lgammal_r(long double, int *);
-#endif
-
-__END_DECLS
#endif /* !_MATH_H_ */

View File

@ -0,0 +1,43 @@
# HG changeset patch
# User Tooru Fujisawa <arai_a@mac.com>
# Date 1452137427 -32400
# Thu Jan 07 12:30:27 2016 +0900
# Node ID 7775dba49d062c28eca221ab804966f1ddd7c359
# Parent b928f0090a041b6eb0c3f8e97f038233f3fda55b
Bug 933257 - Part 2.2: Change include guard in fdlibm.h.
diff --git a/modules/fdlibm/src/fdlibm.h b/modules/fdlibm/src/fdlibm.h
--- a/modules/fdlibm/src/fdlibm.h
+++ b/modules/fdlibm/src/fdlibm.h
@@ -9,18 +9,18 @@
* ====================================================
*/
/*
* from: @(#)fdlibm.h 5.1 93/09/24
* $FreeBSD$
*/
-#ifndef _MATH_H_
-#define _MATH_H_
+#ifndef mozilla_imported_fdlibm_h
+#define mozilla_imported_fdlibm_h
double acos(double);
double asin(double);
double atan(double);
double atan2(double, double);
double cos(double);
double sin(double);
double tan(double);
@@ -51,9 +51,9 @@ double log1p(double);
double log2(double);
double copysign(double, double);
double scalbn(double, int);
double trunc(double);
float floorf(float);
-#endif /* !_MATH_H_ */
+#endif /* mozilla_imported_fdlibm_h */

View File

@ -0,0 +1,42 @@
# HG changeset patch
# User Tooru Fujisawa <arai_a@mac.com>
# Date 1452576831 -32400
# Tue Jan 12 14:33:51 2016 +0900
# Node ID e373cdb8b0bd45124a485cc1c0cc9c6c848a189f
# Parent 7775dba49d062c28eca221ab804966f1ddd7c359
Bug 933257 - Part 2.3: Put fdlibm functions into fdlibm namespace.
diff --git a/modules/fdlibm/src/fdlibm.h b/modules/fdlibm/src/fdlibm.h
--- a/modules/fdlibm/src/fdlibm.h
+++ b/modules/fdlibm/src/fdlibm.h
@@ -12,16 +12,18 @@
/*
* from: @(#)fdlibm.h 5.1 93/09/24
* $FreeBSD$
*/
#ifndef mozilla_imported_fdlibm_h
#define mozilla_imported_fdlibm_h
+namespace fdlibm {
+
double acos(double);
double asin(double);
double atan(double);
double atan2(double, double);
double cos(double);
double sin(double);
double tan(double);
@@ -51,9 +53,11 @@ double log1p(double);
double log2(double);
double copysign(double, double);
double scalbn(double, int);
double trunc(double);
float floorf(float);
+} /* namespace fdlibm */
+
#endif /* mozilla_imported_fdlibm_h */

View File

@ -0,0 +1,807 @@
# HG changeset patch
# User Tooru Fujisawa <arai_a@mac.com>
# Date 1452137427 -32400
# Thu Jan 07 12:30:27 2016 +0900
# Node ID 665da2f4f3d629b2355a00baa861215b05788268
# Parent e373cdb8b0bd45124a485cc1c0cc9c6c848a189f
Bug 933257 - Part 2.4: Include fdlibm.h from math_private.h.
diff --git a/modules/fdlibm/src/e_acos.cpp b/modules/fdlibm/src/e_acos.cpp
--- a/modules/fdlibm/src/e_acos.cpp
+++ b/modules/fdlibm/src/e_acos.cpp
@@ -35,17 +35,16 @@
* 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/modules/fdlibm/src/e_acosh.cpp b/modules/fdlibm/src/e_acosh.cpp
--- a/modules/fdlibm/src/e_acosh.cpp
+++ b/modules/fdlibm/src/e_acosh.cpp
@@ -26,17 +26,16 @@
*
* 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/modules/fdlibm/src/e_asin.cpp b/modules/fdlibm/src/e_asin.cpp
--- a/modules/fdlibm/src/e_asin.cpp
+++ b/modules/fdlibm/src/e_asin.cpp
@@ -41,17 +41,16 @@
* 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/modules/fdlibm/src/e_atan2.cpp b/modules/fdlibm/src/e_atan2.cpp
--- a/modules/fdlibm/src/e_atan2.cpp
+++ b/modules/fdlibm/src/e_atan2.cpp
@@ -39,17 +39,16 @@
* 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/modules/fdlibm/src/e_atanh.cpp b/modules/fdlibm/src/e_atanh.cpp
--- a/modules/fdlibm/src/e_atanh.cpp
+++ b/modules/fdlibm/src/e_atanh.cpp
@@ -30,17 +30,16 @@
* 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/modules/fdlibm/src/e_cosh.cpp b/modules/fdlibm/src/e_cosh.cpp
--- a/modules/fdlibm/src/e_cosh.cpp
+++ b/modules/fdlibm/src/e_cosh.cpp
@@ -32,17 +32,16 @@
*
* 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/modules/fdlibm/src/e_exp.cpp b/modules/fdlibm/src/e_exp.cpp
--- a/modules/fdlibm/src/e_exp.cpp
+++ b/modules/fdlibm/src/e_exp.cpp
@@ -73,17 +73,16 @@
* 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/modules/fdlibm/src/e_hypot.cpp b/modules/fdlibm/src/e_hypot.cpp
--- a/modules/fdlibm/src/e_hypot.cpp
+++ b/modules/fdlibm/src/e_hypot.cpp
@@ -43,17 +43,16 @@
*
* 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/modules/fdlibm/src/e_log.cpp b/modules/fdlibm/src/e_log.cpp
--- a/modules/fdlibm/src/e_log.cpp
+++ b/modules/fdlibm/src/e_log.cpp
@@ -62,17 +62,16 @@
* 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/modules/fdlibm/src/e_log10.cpp b/modules/fdlibm/src/e_log10.cpp
--- a/modules/fdlibm/src/e_log10.cpp
+++ b/modules/fdlibm/src/e_log10.cpp
@@ -19,17 +19,16 @@
* 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/modules/fdlibm/src/e_log2.cpp b/modules/fdlibm/src/e_log2.cpp
--- a/modules/fdlibm/src/e_log2.cpp
+++ b/modules/fdlibm/src/e_log2.cpp
@@ -21,17 +21,16 @@
* 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/modules/fdlibm/src/e_pow.cpp b/modules/fdlibm/src/e_pow.cpp
--- a/modules/fdlibm/src/e_pow.cpp
+++ b/modules/fdlibm/src/e_pow.cpp
@@ -52,17 +52,16 @@
*
* 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 "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,
one = 1.0,
diff --git a/modules/fdlibm/src/e_rem_pio2.cpp b/modules/fdlibm/src/e_rem_pio2.cpp
--- a/modules/fdlibm/src/e_rem_pio2.cpp
+++ b/modules/fdlibm/src/e_rem_pio2.cpp
@@ -19,17 +19,16 @@
/* __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/modules/fdlibm/src/e_sinh.cpp b/modules/fdlibm/src/e_sinh.cpp
--- a/modules/fdlibm/src/e_sinh.cpp
+++ b/modules/fdlibm/src/e_sinh.cpp
@@ -29,17 +29,16 @@
*
* 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/modules/fdlibm/src/e_sqrt.cpp b/modules/fdlibm/src/e_sqrt.cpp
--- a/modules/fdlibm/src/e_sqrt.cpp
+++ b/modules/fdlibm/src/e_sqrt.cpp
@@ -81,17 +81,16 @@
* sqrt(NaN) = NaN ... with invalid signal for signaling NaN
*
* Other methods : see the appended file at the end of the program below.
*---------------
*/
#include <float.h>
-#include "math.h"
#include "math_private.h"
static const double one = 1.0, tiny=1.0e-300;
double
__ieee754_sqrt(double x)
{
double z;
diff --git a/modules/fdlibm/src/k_cos.cpp b/modules/fdlibm/src/k_cos.cpp
--- a/modules/fdlibm/src/k_cos.cpp
+++ b/modules/fdlibm/src/k_cos.cpp
@@ -48,17 +48,16 @@
* 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/modules/fdlibm/src/k_exp.cpp b/modules/fdlibm/src/k_exp.cpp
--- a/modules/fdlibm/src/k_exp.cpp
+++ b/modules/fdlibm/src/k_exp.cpp
@@ -24,17 +24,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/modules/fdlibm/src/k_rem_pio2.cpp b/modules/fdlibm/src/k_rem_pio2.cpp
--- a/modules/fdlibm/src/k_rem_pio2.cpp
+++ b/modules/fdlibm/src/k_rem_pio2.cpp
@@ -126,17 +126,16 @@
* 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/modules/fdlibm/src/k_sin.cpp b/modules/fdlibm/src/k_sin.cpp
--- a/modules/fdlibm/src/k_sin.cpp
+++ b/modules/fdlibm/src/k_sin.cpp
@@ -39,17 +39,16 @@
* ~ 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/modules/fdlibm/src/k_tan.cpp b/modules/fdlibm/src/k_tan.cpp
--- a/modules/fdlibm/src/k_tan.cpp
+++ b/modules/fdlibm/src/k_tan.cpp
@@ -44,17 +44,16 @@
* 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/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h
--- a/modules/fdlibm/src/math_private.h
+++ b/modules/fdlibm/src/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/modules/fdlibm/src/s_asinh.cpp b/modules/fdlibm/src/s_asinh.cpp
--- a/modules/fdlibm/src/s_asinh.cpp
+++ b/modules/fdlibm/src/s_asinh.cpp
@@ -21,17 +21,16 @@
* 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/modules/fdlibm/src/s_atan.cpp b/modules/fdlibm/src/s_atan.cpp
--- a/modules/fdlibm/src/s_atan.cpp
+++ b/modules/fdlibm/src/s_atan.cpp
@@ -30,17 +30,16 @@
* 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/modules/fdlibm/src/s_cbrt.cpp b/modules/fdlibm/src/s_cbrt.cpp
--- a/modules/fdlibm/src/s_cbrt.cpp
+++ b/modules/fdlibm/src/s_cbrt.cpp
@@ -10,17 +10,16 @@
* ====================================================
*
* Optimized by Bruce D. Evans.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#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/modules/fdlibm/src/s_ceil.cpp b/modules/fdlibm/src/s_ceil.cpp
--- a/modules/fdlibm/src/s_ceil.cpp
+++ b/modules/fdlibm/src/s_ceil.cpp
@@ -19,17 +19,16 @@
* 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/modules/fdlibm/src/s_ceilf.cpp b/modules/fdlibm/src/s_ceilf.cpp
--- a/modules/fdlibm/src/s_ceilf.cpp
+++ b/modules/fdlibm/src/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/modules/fdlibm/src/s_copysign.cpp b/modules/fdlibm/src/s_copysign.cpp
--- a/modules/fdlibm/src/s_copysign.cpp
+++ b/modules/fdlibm/src/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/modules/fdlibm/src/s_cos.cpp b/modules/fdlibm/src/s_cos.cpp
--- a/modules/fdlibm/src/s_cos.cpp
+++ b/modules/fdlibm/src/s_cos.cpp
@@ -41,17 +41,16 @@
* 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/modules/fdlibm/src/s_expm1.cpp b/modules/fdlibm/src/s_expm1.cpp
--- a/modules/fdlibm/src/s_expm1.cpp
+++ b/modules/fdlibm/src/s_expm1.cpp
@@ -105,17 +105,16 @@
* 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/modules/fdlibm/src/s_fabs.cpp b/modules/fdlibm/src/s_fabs.cpp
--- a/modules/fdlibm/src/s_fabs.cpp
+++ b/modules/fdlibm/src/s_fabs.cpp
@@ -13,17 +13,16 @@
#ifndef lint
static char rcsid[] = "$FreeBSD$";
#endif
/*
* 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/modules/fdlibm/src/s_floor.cpp b/modules/fdlibm/src/s_floor.cpp
--- a/modules/fdlibm/src/s_floor.cpp
+++ b/modules/fdlibm/src/s_floor.cpp
@@ -19,17 +19,16 @@
* 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/modules/fdlibm/src/s_floorf.cpp b/modules/fdlibm/src/s_floorf.cpp
--- a/modules/fdlibm/src/s_floorf.cpp
+++ b/modules/fdlibm/src/s_floorf.cpp
@@ -20,17 +20,16 @@
* 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/modules/fdlibm/src/s_log1p.cpp b/modules/fdlibm/src/s_log1p.cpp
--- a/modules/fdlibm/src/s_log1p.cpp
+++ b/modules/fdlibm/src/s_log1p.cpp
@@ -75,17 +75,16 @@
* 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/modules/fdlibm/src/s_scalbn.cpp b/modules/fdlibm/src/s_scalbn.cpp
--- a/modules/fdlibm/src/s_scalbn.cpp
+++ b/modules/fdlibm/src/s_scalbn.cpp
@@ -19,17 +19,16 @@ static char rcsid[] = "$FreeBSD$";
* scalbn(x,n) returns x* 2**n computed by exponent
* manipulation rather than by actually performing an
* exponentiation or a multiplication.
*/
#include <sys/cdefs.h>
#include <float.h>
-#include "math.h"
#include "math_private.h"
static const double
two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
huge = 1.0e+300,
tiny = 1.0e-300;
diff --git a/modules/fdlibm/src/s_sin.cpp b/modules/fdlibm/src/s_sin.cpp
--- a/modules/fdlibm/src/s_sin.cpp
+++ b/modules/fdlibm/src/s_sin.cpp
@@ -41,17 +41,16 @@
* 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/modules/fdlibm/src/s_tan.cpp b/modules/fdlibm/src/s_tan.cpp
--- a/modules/fdlibm/src/s_tan.cpp
+++ b/modules/fdlibm/src/s_tan.cpp
@@ -40,17 +40,16 @@
* 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/modules/fdlibm/src/s_tanh.cpp b/modules/fdlibm/src/s_tanh.cpp
--- a/modules/fdlibm/src/s_tanh.cpp
+++ b/modules/fdlibm/src/s_tanh.cpp
@@ -34,17 +34,16 @@
*
* 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/modules/fdlibm/src/s_trunc.cpp b/modules/fdlibm/src/s_trunc.cpp
--- a/modules/fdlibm/src/s_trunc.cpp
+++ b/modules/fdlibm/src/s_trunc.cpp
@@ -19,17 +19,16 @@
* 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;

View File

@ -0,0 +1,29 @@
# HG changeset patch
# User Tooru Fujisawa <arai_a@mac.com>
# Date 1452137427 -32400
# Thu Jan 07 12:30:27 2016 +0900
# Node ID 3401cadca8fbae3674cba1dbe5bf724e19a7439f
# Parent 665da2f4f3d629b2355a00baa861215b05788268
Bug 933257 - Part 2.5: Include stdint.h in math_private.h.
diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h
--- a/modules/fdlibm/src/math_private.h
+++ b/modules/fdlibm/src/math_private.h
@@ -12,16 +12,17 @@
/*
* from: @(#)fdlibm.h 5.1 93/09/24
* $FreeBSD$
*/
#ifndef _MATH_PRIVATE_H_
#define _MATH_PRIVATE_H_
+#include <stdint.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 *

View File

@ -0,0 +1,82 @@
# HG changeset patch
# User Tooru Fujisawa <arai_a@mac.com>
# Date 1452137427 -32400
# Thu Jan 07 12:30:27 2016 +0900
# Node ID fee80779e1a955046e15b0b07a8ad95ea0a125f1
# Parent 3401cadca8fbae3674cba1dbe5bf724e19a7439f
Bug 933257 - Part 2.6: Use mfbt/Endian.h in math_private.h.
diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h
--- a/modules/fdlibm/src/math_private.h
+++ b/modules/fdlibm/src/math_private.h
@@ -14,20 +14,21 @@
* $FreeBSD$
*/
#ifndef _MATH_PRIVATE_H_
#define _MATH_PRIVATE_H_
#include <stdint.h>
#include <sys/types.h>
-#include <machine/endian.h>
#include "fdlibm.h"
+#include "mozilla/Endian.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.
@@ -36,27 +37,17 @@
* endianness at run time.
*/
/*
* A union which permits us to convert between a double and two 32 bit
* ints.
*/
-#ifdef __arm__
-#if defined(__VFP_FP__) || defined(__ARM_EABI__)
-#define IEEE_WORD_ORDER BYTE_ORDER
-#else
-#define IEEE_WORD_ORDER BIG_ENDIAN
-#endif
-#else /* __arm__ */
-#define IEEE_WORD_ORDER BYTE_ORDER
-#endif
-
-#if IEEE_WORD_ORDER == BIG_ENDIAN
+#if MOZ_BIG_ENDIAN
typedef union
{
double value;
struct
{
u_int32_t msw;
u_int32_t lsw;
@@ -64,17 +55,17 @@ typedef union
struct
{
u_int64_t w;
} xparts;
} ieee_double_shape_type;
#endif
-#if IEEE_WORD_ORDER == LITTLE_ENDIAN
+#if MOZ_LITTLE_ENDIAN
typedef union
{
double value;
struct
{
u_int32_t lsw;
u_int32_t msw;

View File

@ -0,0 +1,61 @@
# HG changeset patch
# User Tooru Fujisawa <arai_a@mac.com>
# Date 1452137428 -32400
# Thu Jan 07 12:30:28 2016 +0900
# Node ID c562cc8bf5092962341e3fd1a20223f244666e8b
# Parent fee80779e1a955046e15b0b07a8ad95ea0a125f1
Bug 933257 - Part 2.7: Add fdlibm namespace to functions defined and used in fdlibm.
diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h
--- a/modules/fdlibm/src/math_private.h
+++ b/modules/fdlibm/src/math_private.h
@@ -724,16 +724,49 @@ irintl(long double x)
#define __ieee754_j1f j1f
#define __ieee754_y0f y0f
#define __ieee754_y1f y1f
#define __ieee754_jnf jnf
#define __ieee754_ynf ynf
#define __ieee754_remainderf remainderf
#define __ieee754_scalbf scalbf
+#define acos fdlibm::acos
+#define asin fdlibm::asin
+#define atan fdlibm::atan
+#define atan2 fdlibm::atan2
+#define cos fdlibm::cos
+#define sin fdlibm::sin
+#define tan fdlibm::tan
+#define cosh fdlibm::cosh
+#define sinh fdlibm::sinh
+#define tanh fdlibm::tanh
+#define exp fdlibm::exp
+#define log fdlibm::log
+#define log10 fdlibm::log10
+#define pow fdlibm::pow
+#define sqrt fdlibm::sqrt
+#define ceil fdlibm::ceil
+#define ceilf fdlibm::ceilf
+#define fabs fdlibm::fabs
+#define floor fdlibm::floor
+#define acosh fdlibm::acosh
+#define asinh fdlibm::asinh
+#define atanh fdlibm::atanh
+#define cbrt fdlibm::cbrt
+#define expm1 fdlibm::expm1
+#define hypot fdlibm::hypot
+#define log1p fdlibm::log1p
+#define log2 fdlibm::log2
+#define scalb fdlibm::scalb
+#define copysign fdlibm::copysign
+#define scalbn fdlibm::scalbn
+#define trunc fdlibm::trunc
+#define floorf fdlibm::floorf
+
/* fdlibm kernel function */
int __kernel_rem_pio2(double*,double*,int,int,int);
/* double precision kernel functions */
#ifndef INLINE_REM_PIO2
int __ieee754_rem_pio2(double,double*);
#endif
double __kernel_sin(double,double,int);

View File

@ -0,0 +1,74 @@
# HG changeset patch
# User Tooru Fujisawa <arai_a@mac.com>
# Date 1452576930 -32400
# Tue Jan 12 14:35:30 2016 +0900
# Node ID f89358beccec76c798b417ebd54eb9e153c6de02
# Parent c562cc8bf5092962341e3fd1a20223f244666e8b
Bug 933257 - Part 2.8: Fix include filename in s_cos.cpp, s_sin.cpp, and s_tan.cpp.
diff --git a/modules/fdlibm/src/s_cos.cpp b/modules/fdlibm/src/s_cos.cpp
--- a/modules/fdlibm/src/s_cos.cpp
+++ b/modules/fdlibm/src/s_cos.cpp
@@ -43,17 +43,17 @@
* Accuracy:
* TRIG(x) returns trig(x) nearly rounded
*/
#include <float.h>
#define INLINE_REM_PIO2
#include "math_private.h"
-#include "e_rem_pio2.c"
+#include "e_rem_pio2.cpp"
double
cos(double x)
{
double y[2],z=0.0;
int32_t n, ix;
/* High word of x. */
diff --git a/modules/fdlibm/src/s_sin.cpp b/modules/fdlibm/src/s_sin.cpp
--- a/modules/fdlibm/src/s_sin.cpp
+++ b/modules/fdlibm/src/s_sin.cpp
@@ -43,17 +43,17 @@
* Accuracy:
* TRIG(x) returns trig(x) nearly rounded
*/
#include <float.h>
#define INLINE_REM_PIO2
#include "math_private.h"
-#include "e_rem_pio2.c"
+#include "e_rem_pio2.cpp"
double
sin(double x)
{
double y[2],z=0.0;
int32_t n, ix;
/* High word of x. */
diff --git a/modules/fdlibm/src/s_tan.cpp b/modules/fdlibm/src/s_tan.cpp
--- a/modules/fdlibm/src/s_tan.cpp
+++ b/modules/fdlibm/src/s_tan.cpp
@@ -42,17 +42,17 @@
* Accuracy:
* TRIG(x) returns trig(x) nearly rounded
*/
#include <float.h>
#define INLINE_REM_PIO2
#include "math_private.h"
-#include "e_rem_pio2.c"
+#include "e_rem_pio2.cpp"
double
tan(double x)
{
double y[2],z=0.0;
int32_t n, ix;
/* High word of x. */

View File

@ -0,0 +1,433 @@
# HG changeset patch
# User Tooru Fujisawa <arai_a@mac.com>
# Date 1452137428 -32400
# Thu Jan 07 12:30:28 2016 +0900
# Node ID c42b685e30acd45a33cf42289f73835018be2daf
# Parent f89358beccec76c798b417ebd54eb9e153c6de02
Bug 933257 - Part 2.9: Remove __weak_reference macro.
diff --git a/modules/fdlibm/src/e_acos.cpp b/modules/fdlibm/src/e_acos.cpp
--- a/modules/fdlibm/src/e_acos.cpp
+++ b/modules/fdlibm/src/e_acos.cpp
@@ -99,12 +99,8 @@ double
c = (z-df*df)/(s+df);
p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5)))));
q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4)));
r = p/q;
w = r*s+c;
return 2.0*(df+w);
}
}
-
-#if LDBL_MANT_DIG == 53
-__weak_reference(acos, acosl);
-#endif
diff --git a/modules/fdlibm/src/e_acosh.cpp b/modules/fdlibm/src/e_acosh.cpp
--- a/modules/fdlibm/src/e_acosh.cpp
+++ b/modules/fdlibm/src/e_acosh.cpp
@@ -56,12 +56,8 @@ double
} else if (hx > 0x40000000) { /* 2**28 > x > 2 */
t=x*x;
return __ieee754_log(2.0*x-one/(x+sqrt(t-one)));
} else { /* 1<x<2 */
t = x-one;
return log1p(t+sqrt(2.0*t+t*t));
}
}
-
-#if LDBL_MANT_DIG == 53
-__weak_reference(acosh, acoshl);
-#endif
diff --git a/modules/fdlibm/src/e_asin.cpp b/modules/fdlibm/src/e_asin.cpp
--- a/modules/fdlibm/src/e_asin.cpp
+++ b/modules/fdlibm/src/e_asin.cpp
@@ -105,12 +105,8 @@ double
c = (t-w*w)/(s+w);
r = p/q;
p = 2.0*s*r-(pio2_lo-2.0*c);
q = pio4_hi-2.0*w;
t = pio4_hi-(p-q);
}
if(hx>0) return t; else return -t;
}
-
-#if LDBL_MANT_DIG == 53
-__weak_reference(asin, asinl);
-#endif
diff --git a/modules/fdlibm/src/e_atan2.cpp b/modules/fdlibm/src/e_atan2.cpp
--- a/modules/fdlibm/src/e_atan2.cpp
+++ b/modules/fdlibm/src/e_atan2.cpp
@@ -117,12 +117,8 @@ double
switch (m) {
case 0: return z ; /* atan(+,+) */
case 1: return -z ; /* atan(-,+) */
case 2: return pi-(z-pi_lo);/* atan(+,-) */
default: /* case 3 */
return (z-pi_lo)-pi;/* atan(-,-) */
}
}
-
-#if LDBL_MANT_DIG == 53
-__weak_reference(atan2, atan2l);
-#endif
diff --git a/modules/fdlibm/src/e_atanh.cpp b/modules/fdlibm/src/e_atanh.cpp
--- a/modules/fdlibm/src/e_atanh.cpp
+++ b/modules/fdlibm/src/e_atanh.cpp
@@ -56,12 +56,8 @@ double
SET_HIGH_WORD(x,ix);
if(ix<0x3fe00000) { /* x < 0.5 */
t = x+x;
t = 0.5*log1p(t+t*x/(one-x));
} else
t = 0.5*log1p((x+x)/(one-x));
if(hx>=0) return t; else return -t;
}
-
-#if LDBL_MANT_DIG == 53
-__weak_reference(atanh, atanhl);
-#endif
diff --git a/modules/fdlibm/src/e_cosh.cpp b/modules/fdlibm/src/e_cosh.cpp
--- a/modules/fdlibm/src/e_cosh.cpp
+++ b/modules/fdlibm/src/e_cosh.cpp
@@ -73,12 +73,8 @@ double
/* |x| in [log(maxdouble), overflowthresold] */
if (ix<=0x408633CE)
return __ldexp_exp(fabs(x), -1);
/* |x| > overflowthresold, cosh(x) overflow */
return huge*huge;
}
-
-#if (LDBL_MANT_DIG == 53)
-__weak_reference(cosh, coshl);
-#endif
diff --git a/modules/fdlibm/src/e_exp.cpp b/modules/fdlibm/src/e_exp.cpp
--- a/modules/fdlibm/src/e_exp.cpp
+++ b/modules/fdlibm/src/e_exp.cpp
@@ -152,12 +152,8 @@ double
else y = one-((lo-(x*c)/(2.0-c))-hi);
if(k >= -1021) {
if (k==1024) return y*2.0*0x1p1023;
return y*twopk;
} else {
return y*twopk*twom1000;
}
}
-
-#if (LDBL_MANT_DIG == 53)
-__weak_reference(exp, expl);
-#endif
diff --git a/modules/fdlibm/src/e_hypot.cpp b/modules/fdlibm/src/e_hypot.cpp
--- a/modules/fdlibm/src/e_hypot.cpp
+++ b/modules/fdlibm/src/e_hypot.cpp
@@ -119,12 +119,8 @@ double
if(k!=0) {
u_int32_t high;
t1 = 1.0;
GET_HIGH_WORD(high,t1);
SET_HIGH_WORD(t1,high+(k<<20));
return t1*w;
} else return w;
}
-
-#if LDBL_MANT_DIG == 53
-__weak_reference(hypot, hypotl);
-#endif
diff --git a/modules/fdlibm/src/e_log.cpp b/modules/fdlibm/src/e_log.cpp
--- a/modules/fdlibm/src/e_log.cpp
+++ b/modules/fdlibm/src/e_log.cpp
@@ -135,12 +135,8 @@ double
hfsq=0.5*f*f;
if(k==0) return f-(hfsq-s*(hfsq+R)); else
return dk*ln2_hi-((hfsq-(s*(hfsq+R)+dk*ln2_lo))-f);
} else {
if(k==0) return f-s*(f-R); else
return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f);
}
}
-
-#if (LDBL_MANT_DIG == 53)
-__weak_reference(log, logl);
-#endif
diff --git a/modules/fdlibm/src/e_log10.cpp b/modules/fdlibm/src/e_log10.cpp
--- a/modules/fdlibm/src/e_log10.cpp
+++ b/modules/fdlibm/src/e_log10.cpp
@@ -82,12 +82,8 @@ double
* with some parallelism and it reduces the error for many args.
*/
w = y2 + val_hi;
val_lo += (y2 - w) + val_hi;
val_hi = w;
return val_lo + val_hi;
}
-
-#if (LDBL_MANT_DIG == 53)
-__weak_reference(log10, log10l);
-#endif
diff --git a/modules/fdlibm/src/e_log2.cpp b/modules/fdlibm/src/e_log2.cpp
--- a/modules/fdlibm/src/e_log2.cpp
+++ b/modules/fdlibm/src/e_log2.cpp
@@ -105,12 +105,8 @@ double
/* spadd(val_hi, val_lo, y), except for not using double_t: */
w = y + val_hi;
val_lo += (y - w) + val_hi;
val_hi = w;
return val_lo + val_hi;
}
-
-#if (LDBL_MANT_DIG == 53)
-__weak_reference(log2, log2l);
-#endif
diff --git a/modules/fdlibm/src/e_sinh.cpp b/modules/fdlibm/src/e_sinh.cpp
--- a/modules/fdlibm/src/e_sinh.cpp
+++ b/modules/fdlibm/src/e_sinh.cpp
@@ -67,12 +67,8 @@ double
/* |x| in [log(maxdouble), overflowthresold] */
if (ix<=0x408633CE)
return h*2.0*__ldexp_exp(fabs(x), -1);
/* |x| > overflowthresold, sinh(x) overflow */
return x*shuge;
}
-
-#if (LDBL_MANT_DIG == 53)
-__weak_reference(sinh, sinhl);
-#endif
diff --git a/modules/fdlibm/src/e_sqrt.cpp b/modules/fdlibm/src/e_sqrt.cpp
--- a/modules/fdlibm/src/e_sqrt.cpp
+++ b/modules/fdlibm/src/e_sqrt.cpp
@@ -182,20 +182,16 @@ double
ix0 = (q>>1)+0x3fe00000;
ix1 = q1>>1;
if ((q&1)==1) ix1 |= sign;
ix0 += (m <<20);
INSERT_WORDS(z,ix0,ix1);
return z;
}
-#if (LDBL_MANT_DIG == 53)
-__weak_reference(sqrt, sqrtl);
-#endif
-
/*
Other methods (use floating-point arithmetic)
-------------
(This is a copy of a drafted paper by Prof W. Kahan
and K.C. Ng, written in May, 1986)
Two algorithms are given here to implement sqrt(x)
(IEEE double precision arithmetic) in software.
diff --git a/modules/fdlibm/src/s_asinh.cpp b/modules/fdlibm/src/s_asinh.cpp
--- a/modules/fdlibm/src/s_asinh.cpp
+++ b/modules/fdlibm/src/s_asinh.cpp
@@ -50,12 +50,8 @@ asinh(double x)
t = fabs(x);
w = __ieee754_log(2.0*t+one/(__ieee754_sqrt(x*x+one)+t));
} else { /* 2.0 > |x| > 2**-28 */
t = x*x;
w =log1p(fabs(x)+t/(one+__ieee754_sqrt(one+t)));
}
if(hx>0) return w; else return -w;
}
-
-#if LDBL_MANT_DIG == 53
-__weak_reference(asinh, asinhl);
-#endif
diff --git a/modules/fdlibm/src/s_atan.cpp b/modules/fdlibm/src/s_atan.cpp
--- a/modules/fdlibm/src/s_atan.cpp
+++ b/modules/fdlibm/src/s_atan.cpp
@@ -112,12 +112,8 @@ atan(double x)
s1 = z*(aT[0]+w*(aT[2]+w*(aT[4]+w*(aT[6]+w*(aT[8]+w*aT[10])))));
s2 = w*(aT[1]+w*(aT[3]+w*(aT[5]+w*(aT[7]+w*aT[9]))));
if (id<0) return x - x*(s1+s2);
else {
z = atanhi[id] - ((x*(s1+s2) - atanlo[id]) - x);
return (hx<0)? -z:z;
}
}
-
-#if LDBL_MANT_DIG == 53
-__weak_reference(atan, atanl);
-#endif
diff --git a/modules/fdlibm/src/s_cbrt.cpp b/modules/fdlibm/src/s_cbrt.cpp
--- a/modules/fdlibm/src/s_cbrt.cpp
+++ b/modules/fdlibm/src/s_cbrt.cpp
@@ -105,12 +105,8 @@ cbrt(double x)
s=t*t; /* t*t is exact */
r=x/s; /* error <= 0.5 ulps; |r| < |t| */
w=t+t; /* t+t is exact */
r=(r-t)/(w+r); /* r-t is exact; w+r ~= 3*t */
t=t+t*r; /* error <= 0.5 + 0.5/3 + epsilon */
return(t);
}
-
-#if (LDBL_MANT_DIG == 53)
-__weak_reference(cbrt, cbrtl);
-#endif
diff --git a/modules/fdlibm/src/s_ceil.cpp b/modules/fdlibm/src/s_ceil.cpp
--- a/modules/fdlibm/src/s_ceil.cpp
+++ b/modules/fdlibm/src/s_ceil.cpp
@@ -65,12 +65,8 @@ ceil(double x)
}
}
i1 &= (~i);
}
}
INSERT_WORDS(x,i0,i1);
return x;
}
-
-#if LDBL_MANT_DIG == 53
-__weak_reference(ceil, ceill);
-#endif
diff --git a/modules/fdlibm/src/s_cos.cpp b/modules/fdlibm/src/s_cos.cpp
--- a/modules/fdlibm/src/s_cos.cpp
+++ b/modules/fdlibm/src/s_cos.cpp
@@ -77,12 +77,8 @@ cos(double x)
case 0: return __kernel_cos(y[0],y[1]);
case 1: return -__kernel_sin(y[0],y[1],1);
case 2: return -__kernel_cos(y[0],y[1]);
default:
return __kernel_sin(y[0],y[1],1);
}
}
}
-
-#if (LDBL_MANT_DIG == 53)
-__weak_reference(cos, cosl);
-#endif
diff --git a/modules/fdlibm/src/s_expm1.cpp b/modules/fdlibm/src/s_expm1.cpp
--- a/modules/fdlibm/src/s_expm1.cpp
+++ b/modules/fdlibm/src/s_expm1.cpp
@@ -210,12 +210,8 @@ expm1(double x)
SET_HIGH_WORD(t,((0x3ff-k)<<20)); /* 2^-k */
y = x-(e+t);
y += one;
y = y*twopk;
}
}
return y;
}
-
-#if (LDBL_MANT_DIG == 53)
-__weak_reference(expm1, expm1l);
-#endif
diff --git a/modules/fdlibm/src/s_floor.cpp b/modules/fdlibm/src/s_floor.cpp
--- a/modules/fdlibm/src/s_floor.cpp
+++ b/modules/fdlibm/src/s_floor.cpp
@@ -66,12 +66,8 @@ floor(double x)
}
}
i1 &= (~i);
}
}
INSERT_WORDS(x,i0,i1);
return x;
}
-
-#if LDBL_MANT_DIG == 53
-__weak_reference(floor, floorl);
-#endif
diff --git a/modules/fdlibm/src/s_log1p.cpp b/modules/fdlibm/src/s_log1p.cpp
--- a/modules/fdlibm/src/s_log1p.cpp
+++ b/modules/fdlibm/src/s_log1p.cpp
@@ -168,12 +168,8 @@ log1p(double x)
return k*ln2_hi-((R-(k*ln2_lo+c))-f);
}
s = f/(2.0+f);
z = s*s;
R = z*(Lp1+z*(Lp2+z*(Lp3+z*(Lp4+z*(Lp5+z*(Lp6+z*Lp7))))));
if(k==0) return f-(hfsq-s*(hfsq+R)); else
return k*ln2_hi-((hfsq-(s*(hfsq+R)+(k*ln2_lo+c)))-f);
}
-
-#if (LDBL_MANT_DIG == 53)
-__weak_reference(log1p, log1pl);
-#endif
diff --git a/modules/fdlibm/src/s_scalbn.cpp b/modules/fdlibm/src/s_scalbn.cpp
--- a/modules/fdlibm/src/s_scalbn.cpp
+++ b/modules/fdlibm/src/s_scalbn.cpp
@@ -53,13 +53,8 @@ scalbn (double x, int n)
if (k <= -54)
if (n > 50000) /* in case integer overflow in n+k */
return huge*copysign(huge,x); /*overflow*/
else return tiny*copysign(tiny,x); /*underflow*/
k += 54; /* subnormal result */
SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20));
return x*twom54;
}
-
-#if (LDBL_MANT_DIG == 53)
-__weak_reference(scalbn, ldexpl);
-__weak_reference(scalbn, scalbnl);
-#endif
diff --git a/modules/fdlibm/src/s_sin.cpp b/modules/fdlibm/src/s_sin.cpp
--- a/modules/fdlibm/src/s_sin.cpp
+++ b/modules/fdlibm/src/s_sin.cpp
@@ -77,12 +77,8 @@ sin(double x)
case 0: return __kernel_sin(y[0],y[1],1);
case 1: return __kernel_cos(y[0],y[1]);
case 2: return -__kernel_sin(y[0],y[1],1);
default:
return -__kernel_cos(y[0],y[1]);
}
}
}
-
-#if (LDBL_MANT_DIG == 53)
-__weak_reference(sin, sinl);
-#endif
diff --git a/modules/fdlibm/src/s_tan.cpp b/modules/fdlibm/src/s_tan.cpp
--- a/modules/fdlibm/src/s_tan.cpp
+++ b/modules/fdlibm/src/s_tan.cpp
@@ -71,12 +71,8 @@ tan(double x)
/* argument reduction needed */
else {
n = __ieee754_rem_pio2(x,y);
return __kernel_tan(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even
-1 -- n odd */
}
}
-
-#if (LDBL_MANT_DIG == 53)
-__weak_reference(tan, tanl);
-#endif
diff --git a/modules/fdlibm/src/s_tanh.cpp b/modules/fdlibm/src/s_tanh.cpp
--- a/modules/fdlibm/src/s_tanh.cpp
+++ b/modules/fdlibm/src/s_tanh.cpp
@@ -72,12 +72,8 @@ tanh(double x)
z= -t/(t+two);
}
/* |x| >= 22, return +-1 */
} else {
z = one - tiny; /* raise inexact flag */
}
return (jx>=0)? z: -z;
}
-
-#if (LDBL_MANT_DIG == 53)
-__weak_reference(tanh, tanhl);
-#endif
diff --git a/modules/fdlibm/src/s_trunc.cpp b/modules/fdlibm/src/s_trunc.cpp
--- a/modules/fdlibm/src/s_trunc.cpp
+++ b/modules/fdlibm/src/s_trunc.cpp
@@ -55,12 +55,8 @@ trunc(double x)
i = ((u_int32_t)(0xffffffff))>>(j0-20);
if((i1&i)==0) return x; /* x is integral */
if(huge+x>0.0) /* raise inexact flag */
i1 &= (~i);
}
INSERT_WORDS(x,i0,i1);
return x;
}
-
-#if LDBL_MANT_DIG == 53
-__weak_reference(trunc, truncl);
-#endif

View File

@ -0,0 +1,48 @@
# HG changeset patch
# User Tooru Fujisawa <arai_a@mac.com>
# Date 1452144085 -32400
# Thu Jan 07 14:21:25 2016 +0900
# Node ID 0e0924da97cdd7ac625f37631a7a97455f1def40
# Parent c42b685e30acd45a33cf42289f73835018be2daf
Bug 933257 - Part 2.10: Replace __inline __always_inline with MOZ_ALWAYS_INLINE.
diff --git a/modules/fdlibm/src/e_rem_pio2.cpp b/modules/fdlibm/src/e_rem_pio2.cpp
--- a/modules/fdlibm/src/e_rem_pio2.cpp
+++ b/modules/fdlibm/src/e_rem_pio2.cpp
@@ -19,16 +19,17 @@
/* __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 "mozilla/Attributes.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)
@@ -43,17 +44,17 @@ invpio2 = 6.36619772367581382433e-01, /
pio2_1 = 1.57079632673412561417e+00, /* 0x3FF921FB, 0x54400000 */
pio2_1t = 6.07710050650619224932e-11, /* 0x3DD0B461, 0x1A626331 */
pio2_2 = 6.07710050630396597660e-11, /* 0x3DD0B461, 0x1A600000 */
pio2_2t = 2.02226624879595063154e-21, /* 0x3BA3198A, 0x2E037073 */
pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */
pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
#ifdef INLINE_REM_PIO2
-static __inline __always_inline
+static MOZ_ALWAYS_INLINE
#endif
int
__ieee754_rem_pio2(double x, double *y)
{
double z,w,t,r,fn;
double tx[3],ty[2];
int32_t e0,i,j,nx,n,ix,hx;
u_int32_t low;

View File

@ -0,0 +1,953 @@
# HG changeset patch
# User Tooru Fujisawa <arai_a@mac.com>
# Date 1452144085 -32400
# Thu Jan 07 14:21:25 2016 +0900
# Node ID e7441fccd976b1598ff22498c39313f13f15bd21
# Parent 0e0924da97cdd7ac625f37631a7a97455f1def40
Bug 933257 - Part 2.11: Comment out rcsid variable.
diff --git a/modules/fdlibm/src/e_acos.cpp b/modules/fdlibm/src/e_acos.cpp
--- a/modules/fdlibm/src/e_acos.cpp
+++ b/modules/fdlibm/src/e_acos.cpp
@@ -6,18 +6,18 @@
*
* Developed at SunSoft, 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_acos(x)
* Method :
* acos(x) = pi/2 - asin(x)
* acos(-x) = pi/2 + asin(x)
* For |x|<=0.5
* acos(x) = pi/2 - (x + x*x^2*R(x^2)) (see asin.c)
* For x>0.5
diff --git a/modules/fdlibm/src/e_acosh.cpp b/modules/fdlibm/src/e_acosh.cpp
--- a/modules/fdlibm/src/e_acosh.cpp
+++ b/modules/fdlibm/src/e_acosh.cpp
@@ -7,18 +7,18 @@
* Developed at SunSoft, 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_acosh(x)
* Method :
* Based on
* acosh(x) = log [ x + sqrt(x*x-1) ]
* we have
* acosh(x) := log(x)+ln2, if x is large; else
* acosh(x) := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else
diff --git a/modules/fdlibm/src/e_asin.cpp b/modules/fdlibm/src/e_asin.cpp
--- a/modules/fdlibm/src/e_asin.cpp
+++ b/modules/fdlibm/src/e_asin.cpp
@@ -6,18 +6,18 @@
*
* Developed at SunSoft, 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_asin(x)
* Method :
* Since asin(x) = x + x^3/6 + x^5*3/40 + x^7*15/336 + ...
* we approximate asin(x) on [0,0.5] by
* asin(x) = x + x*x^2*R(x^2)
* where
* R(x^2) is a rational approximation of (asin(x)-x)/x^3
diff --git a/modules/fdlibm/src/e_atan2.cpp b/modules/fdlibm/src/e_atan2.cpp
--- a/modules/fdlibm/src/e_atan2.cpp
+++ b/modules/fdlibm/src/e_atan2.cpp
@@ -7,18 +7,18 @@
* Developed at SunSoft, 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_atan2(y,x)
* Method :
* 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x).
* 2. Reduce x to positive by (if x and y are unexceptional):
* ARG (x+iy) = arctan(y/x) ... if x > 0,
* ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0,
*
diff --git a/modules/fdlibm/src/e_atanh.cpp b/modules/fdlibm/src/e_atanh.cpp
--- a/modules/fdlibm/src/e_atanh.cpp
+++ b/modules/fdlibm/src/e_atanh.cpp
@@ -7,18 +7,18 @@
* Developed at SunSoft, 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_atanh(x)
* Method :
* 1.Reduced x to positive by atanh(-x) = -atanh(x)
* 2.For x>=0.5
* 1 2x x
* atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------)
* 2 1 - x 1 - x
diff --git a/modules/fdlibm/src/e_cosh.cpp b/modules/fdlibm/src/e_cosh.cpp
--- a/modules/fdlibm/src/e_cosh.cpp
+++ b/modules/fdlibm/src/e_cosh.cpp
@@ -6,18 +6,18 @@
*
* Developed at SunSoft, 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_cosh(x)
* Method :
* mathematically cosh(x) if defined to be (exp(x)+exp(-x))/2
* 1. Replace x by |x| (cosh(x) = cosh(-x)).
* 2.
* [ exp(x) - 1 ]^2
* 0 <= x <= ln2/2 : cosh(x) := 1 + -------------------
diff --git a/modules/fdlibm/src/e_exp.cpp b/modules/fdlibm/src/e_exp.cpp
--- a/modules/fdlibm/src/e_exp.cpp
+++ b/modules/fdlibm/src/e_exp.cpp
@@ -5,18 +5,18 @@
* Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
*
* 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_exp(x)
* Returns the exponential of x.
*
* Method
* 1. Argument reduction:
* Reduce x to an r so that |r| <= 0.5*ln2 ~ 0.34658.
* Given x, find r and integer k such that
diff --git a/modules/fdlibm/src/e_hypot.cpp b/modules/fdlibm/src/e_hypot.cpp
--- a/modules/fdlibm/src/e_hypot.cpp
+++ b/modules/fdlibm/src/e_hypot.cpp
@@ -6,18 +6,18 @@
*
* Developed at SunSoft, 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_hypot(x,y)
*
* Method :
* If (assume round-to-nearest) z=x*x+y*y
* has error less than sqrt(2)/2 ulp, than
* sqrt(z) has error less than 1 ulp (exercise).
*
diff --git a/modules/fdlibm/src/e_log.cpp b/modules/fdlibm/src/e_log.cpp
--- a/modules/fdlibm/src/e_log.cpp
+++ b/modules/fdlibm/src/e_log.cpp
@@ -6,18 +6,18 @@
*
* Developed at SunSoft, 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_log(x)
* Return the logrithm of x
*
* Method :
* 1. Argument Reduction: find k and f such that
* x = 2^k * (1+f),
* where sqrt(2)/2 < 1+f < sqrt(2) .
diff --git a/modules/fdlibm/src/e_log10.cpp b/modules/fdlibm/src/e_log10.cpp
--- a/modules/fdlibm/src/e_log10.cpp
+++ b/modules/fdlibm/src/e_log10.cpp
@@ -6,32 +6,32 @@
*
* Developed at SunSoft, 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$");
/*
* Return the base 10 logarithm of x. See e_log.c and k_log.h for most
* 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_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 */
log10_2lo = 3.69423907715893078616e-13; /* 0x3D59FEF3, 0x11F12B36 */
static const double zero = 0.0;
diff --git a/modules/fdlibm/src/e_log2.cpp b/modules/fdlibm/src/e_log2.cpp
--- a/modules/fdlibm/src/e_log2.cpp
+++ b/modules/fdlibm/src/e_log2.cpp
@@ -6,18 +6,18 @@
*
* Developed at SunSoft, 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$");
/*
* Return the base 2 logarithm of x. See e_log.c and k_log.h for most
* comments.
*
* 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
diff --git a/modules/fdlibm/src/e_pow.cpp b/modules/fdlibm/src/e_pow.cpp
--- a/modules/fdlibm/src/e_pow.cpp
+++ b/modules/fdlibm/src/e_pow.cpp
@@ -4,18 +4,18 @@
* Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
*
* 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_pow(x,y) return x**y
*
* n
* Method: Let x = 2 * (1+f)
* 1. Compute and return log2(x) in two pieces:
* log2(x) = w1 + w2,
* where w1 has 53-24 = 29 bit trailing zeros.
diff --git a/modules/fdlibm/src/e_rem_pio2.cpp b/modules/fdlibm/src/e_rem_pio2.cpp
--- a/modules/fdlibm/src/e_rem_pio2.cpp
+++ b/modules/fdlibm/src/e_rem_pio2.cpp
@@ -8,18 +8,18 @@
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*
* Optimized by Bruce D. Evans.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+//#include <sys/cdefs.h>
+//__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>
diff --git a/modules/fdlibm/src/e_sinh.cpp b/modules/fdlibm/src/e_sinh.cpp
--- a/modules/fdlibm/src/e_sinh.cpp
+++ b/modules/fdlibm/src/e_sinh.cpp
@@ -6,18 +6,18 @@
*
* Developed at SunSoft, 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_sinh(x)
* Method :
* mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2
* 1. Replace x by |x| (sinh(-x) = -sinh(x)).
* 2.
* E + E/(E+1)
* 0 <= x <= 22 : sinh(x) := --------------, E=expm1(x)
diff --git a/modules/fdlibm/src/e_sqrt.cpp b/modules/fdlibm/src/e_sqrt.cpp
--- a/modules/fdlibm/src/e_sqrt.cpp
+++ b/modules/fdlibm/src/e_sqrt.cpp
@@ -6,18 +6,18 @@
*
* Developed at SunSoft, 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_sqrt(x)
* Return correctly rounded sqrt.
* ------------------------------------------
* | Use the hardware sqrt if you have one |
* ------------------------------------------
* Method:
* Bit by bit method using integer arithmetic. (Slow, but portable)
diff --git a/modules/fdlibm/src/k_cos.cpp b/modules/fdlibm/src/k_cos.cpp
--- a/modules/fdlibm/src/k_cos.cpp
+++ b/modules/fdlibm/src/k_cos.cpp
@@ -6,18 +6,18 @@
*
* Developed at SunSoft, 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$");
/*
* __kernel_cos( x, y )
* kernel cos function on [-pi/4, pi/4], pi/4 ~ 0.785398164
* Input x is assumed to be bounded by ~pi/4 in magnitude.
* Input y is the tail of x.
*
* Algorithm
diff --git a/modules/fdlibm/src/k_exp.cpp b/modules/fdlibm/src/k_exp.cpp
--- a/modules/fdlibm/src/k_exp.cpp
+++ b/modules/fdlibm/src/k_exp.cpp
@@ -19,22 +19,22 @@
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* 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"
+ #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/modules/fdlibm/src/k_log.h b/modules/fdlibm/src/k_log.h
--- a/modules/fdlibm/src/k_log.h
+++ b/modules/fdlibm/src/k_log.h
@@ -6,18 +6,18 @@
*
* Developed at SunSoft, 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$");
/*
* k_log1p(f):
* Return log(1+f) - f for 1+f in ~[sqrt(2)/2, sqrt(2)].
*
* The following describes the overall strategy for computing
* logarithms in base e. The argument reduction and adding the final
* term of the polynomial are done by the caller for increased accuracy
diff --git a/modules/fdlibm/src/k_rem_pio2.cpp b/modules/fdlibm/src/k_rem_pio2.cpp
--- a/modules/fdlibm/src/k_rem_pio2.cpp
+++ b/modules/fdlibm/src/k_rem_pio2.cpp
@@ -6,18 +6,18 @@
*
* Developed at SunSoft, 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$");
/*
* __kernel_rem_pio2(x,y,e0,nx,prec)
* double x[],y[]; int e0,nx,prec;
*
* __kernel_rem_pio2 return the last three digits of N with
* y = x - N*pi/2
* so that |y| < pi/2.
diff --git a/modules/fdlibm/src/k_sin.cpp b/modules/fdlibm/src/k_sin.cpp
--- a/modules/fdlibm/src/k_sin.cpp
+++ b/modules/fdlibm/src/k_sin.cpp
@@ -6,18 +6,18 @@
*
* Developed at SunSoft, 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$");
/* __kernel_sin( x, y, iy)
* kernel sin function on ~[-pi/4, pi/4] (except on -0), pi/4 ~ 0.7854
* Input x is assumed to be bounded by ~pi/4 in magnitude.
* Input y is the tail of x.
* Input iy indicates whether y is 0. (if iy=0, y assume to be 0).
*
* Algorithm
diff --git a/modules/fdlibm/src/k_tan.cpp b/modules/fdlibm/src/k_tan.cpp
--- a/modules/fdlibm/src/k_tan.cpp
+++ b/modules/fdlibm/src/k_tan.cpp
@@ -6,18 +6,18 @@
*
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
/* INDENT OFF */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+//#include <sys/cdefs.h>
+//__FBSDID("$FreeBSD$");
/* __kernel_tan( x, y, k )
* kernel tan function on ~[-pi/4, pi/4] (except on -0), pi/4 ~ 0.7854
* Input x is assumed to be bounded by ~pi/4 in magnitude.
* Input y is the tail of x.
* Input k indicates whether tan (if k = 1) or -1/tan (if k = -1) is returned.
*
* Algorithm
diff --git a/modules/fdlibm/src/s_asinh.cpp b/modules/fdlibm/src/s_asinh.cpp
--- a/modules/fdlibm/src/s_asinh.cpp
+++ b/modules/fdlibm/src/s_asinh.cpp
@@ -5,18 +5,18 @@
*
* 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$");
/* asinh(x)
* Method :
* Based on
* asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ]
* we have
* asinh(x) := x if 1+x*x=1,
* := sign(x)*(log(x)+ln2)) for large |x|, else
diff --git a/modules/fdlibm/src/s_atan.cpp b/modules/fdlibm/src/s_atan.cpp
--- a/modules/fdlibm/src/s_atan.cpp
+++ b/modules/fdlibm/src/s_atan.cpp
@@ -5,18 +5,18 @@
*
* 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$");
/* atan(x)
* Method
* 1. Reduce x to positive by atan(x) = -atan(-x).
* 2. According to the integer k=4t+0.25 chopped, t=x, the argument
* is further reduced to one of the following intervals and the
* arctangent of t is evaluated by the corresponding formula:
*
diff --git a/modules/fdlibm/src/s_cbrt.cpp b/modules/fdlibm/src/s_cbrt.cpp
--- a/modules/fdlibm/src/s_cbrt.cpp
+++ b/modules/fdlibm/src/s_cbrt.cpp
@@ -7,18 +7,18 @@
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*
* Optimized by Bruce D. Evans.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+//#include <sys/cdefs.h>
+//__FBSDID("$FreeBSD$");
#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 */
diff --git a/modules/fdlibm/src/s_ceil.cpp b/modules/fdlibm/src/s_ceil.cpp
--- a/modules/fdlibm/src/s_ceil.cpp
+++ b/modules/fdlibm/src/s_ceil.cpp
@@ -5,18 +5,18 @@
*
* 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$");
/*
* ceil(x)
* Return x rounded toward -inf to integral value
* Method:
* Bit twiddling.
* Exception:
* Inexact flag raised if x not equal to ceil(x).
diff --git a/modules/fdlibm/src/s_ceilf.cpp b/modules/fdlibm/src/s_ceilf.cpp
--- a/modules/fdlibm/src/s_ceilf.cpp
+++ b/modules/fdlibm/src/s_ceilf.cpp
@@ -8,18 +8,18 @@
*
* 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 huge = 1.0e30;
float
ceilf(float x)
{
diff --git a/modules/fdlibm/src/s_copysign.cpp b/modules/fdlibm/src/s_copysign.cpp
--- a/modules/fdlibm/src/s_copysign.cpp
+++ b/modules/fdlibm/src/s_copysign.cpp
@@ -5,18 +5,18 @@
*
* 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$");
/*
* 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_private.h"
diff --git a/modules/fdlibm/src/s_cos.cpp b/modules/fdlibm/src/s_cos.cpp
--- a/modules/fdlibm/src/s_cos.cpp
+++ b/modules/fdlibm/src/s_cos.cpp
@@ -5,18 +5,18 @@
*
* 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$");
/* cos(x)
* Return cosine function of x.
*
* kernel function:
* __kernel_sin ... sine function on [-pi/4,pi/4]
* __kernel_cos ... cosine function on [-pi/4,pi/4]
* __ieee754_rem_pio2 ... argument reduction routine
diff --git a/modules/fdlibm/src/s_expm1.cpp b/modules/fdlibm/src/s_expm1.cpp
--- a/modules/fdlibm/src/s_expm1.cpp
+++ b/modules/fdlibm/src/s_expm1.cpp
@@ -5,18 +5,18 @@
*
* 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$");
/* expm1(x)
* Returns exp(x)-1, the exponential of x minus 1.
*
* Method
* 1. Argument reduction:
* Given x, find r and integer k such that
*
diff --git a/modules/fdlibm/src/s_fabs.cpp b/modules/fdlibm/src/s_fabs.cpp
--- a/modules/fdlibm/src/s_fabs.cpp
+++ b/modules/fdlibm/src/s_fabs.cpp
@@ -1,22 +1,22 @@
-/* @(#)s_fabs.c 5.1 93/09/24 */
+ /* @(#)s_fabs.c 5.1 93/09/24 */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* 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$";
+ //static char rcsid[] = "$FreeBSD$";
#endif
/*
* fabs(x) returns the absolute value of x.
*/
#include "math_private.h"
diff --git a/modules/fdlibm/src/s_floor.cpp b/modules/fdlibm/src/s_floor.cpp
--- a/modules/fdlibm/src/s_floor.cpp
+++ b/modules/fdlibm/src/s_floor.cpp
@@ -5,18 +5,18 @@
*
* 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$");
/*
* floor(x)
* Return x rounded toward -inf to integral value
* Method:
* Bit twiddling.
* Exception:
* Inexact flag raised if x not equal to floor(x).
diff --git a/modules/fdlibm/src/s_floorf.cpp b/modules/fdlibm/src/s_floorf.cpp
--- a/modules/fdlibm/src/s_floorf.cpp
+++ b/modules/fdlibm/src/s_floorf.cpp
@@ -8,18 +8,18 @@
*
* 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$");
/*
* floorf(x)
* Return x rounded toward -inf to integral value
* Method:
* Bit twiddling.
* Exception:
* Inexact flag raised if x not equal to floorf(x).
diff --git a/modules/fdlibm/src/s_log1p.cpp b/modules/fdlibm/src/s_log1p.cpp
--- a/modules/fdlibm/src/s_log1p.cpp
+++ b/modules/fdlibm/src/s_log1p.cpp
@@ -5,18 +5,18 @@
*
* 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$");
/* double log1p(double x)
*
* Method :
* 1. Argument Reduction: find k and f such that
* 1+x = 2^k * (1+f),
* where sqrt(2)/2 < 1+f < sqrt(2) .
*
diff --git a/modules/fdlibm/src/s_scalbn.cpp b/modules/fdlibm/src/s_scalbn.cpp
--- a/modules/fdlibm/src/s_scalbn.cpp
+++ b/modules/fdlibm/src/s_scalbn.cpp
@@ -6,27 +6,27 @@
* 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$";
+//static char rcsid[] = "$FreeBSD$";
#endif
/*
* scalbn (double x, int n)
* scalbn(x,n) returns x* 2**n computed by exponent
* manipulation rather than by actually performing an
* exponentiation or a multiplication.
*/
-#include <sys/cdefs.h>
+//#include <sys/cdefs.h>
#include <float.h>
#include "math_private.h"
static const double
two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
huge = 1.0e+300,
diff --git a/modules/fdlibm/src/s_sin.cpp b/modules/fdlibm/src/s_sin.cpp
--- a/modules/fdlibm/src/s_sin.cpp
+++ b/modules/fdlibm/src/s_sin.cpp
@@ -5,18 +5,18 @@
*
* 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$");
/* sin(x)
* Return sine function of x.
*
* kernel function:
* __kernel_sin ... sine function on [-pi/4,pi/4]
* __kernel_cos ... cose function on [-pi/4,pi/4]
* __ieee754_rem_pio2 ... argument reduction routine
diff --git a/modules/fdlibm/src/s_tan.cpp b/modules/fdlibm/src/s_tan.cpp
--- a/modules/fdlibm/src/s_tan.cpp
+++ b/modules/fdlibm/src/s_tan.cpp
@@ -5,18 +5,18 @@
*
* 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$");
/* tan(x)
* Return tangent function of x.
*
* kernel function:
* __kernel_tan ... tangent function on [-pi/4,pi/4]
* __ieee754_rem_pio2 ... argument reduction routine
*
diff --git a/modules/fdlibm/src/s_tanh.cpp b/modules/fdlibm/src/s_tanh.cpp
--- a/modules/fdlibm/src/s_tanh.cpp
+++ b/modules/fdlibm/src/s_tanh.cpp
@@ -5,18 +5,18 @@
*
* 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$");
/* Tanh(x)
* Return the Hyperbolic Tangent of x
*
* Method :
* x -x
* e - e
* 0. tanh(x) is defined to be -----------
diff --git a/modules/fdlibm/src/s_trunc.cpp b/modules/fdlibm/src/s_trunc.cpp
--- a/modules/fdlibm/src/s_trunc.cpp
+++ b/modules/fdlibm/src/s_trunc.cpp
@@ -5,18 +5,18 @@
*
* 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$");
/*
* trunc(x)
* Return x rounded toward 0 to integral value
* Method:
* Bit twiddling.
* Exception:
* Inexact flag raised if x not equal to trunc(x).

View File

@ -0,0 +1,63 @@
# HG changeset patch
# User Tooru Fujisawa <arai_a@mac.com>
# Date 1452576936 -32400
# Tue Jan 12 14:35:36 2016 +0900
# Node ID 0e4d362b6f743a533805aeea9ff700a2de0e4490
# Parent e7441fccd976b1598ff22498c39313f13f15bd21
Bug 933257 - Part 2.14: Remove unused function from k_exp.cpp.
diff --git a/modules/fdlibm/src/k_exp.cpp b/modules/fdlibm/src/k_exp.cpp
--- a/modules/fdlibm/src/k_exp.cpp
+++ b/modules/fdlibm/src/k_exp.cpp
@@ -22,18 +22,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 = 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'.
@@ -76,32 +74,8 @@ double
double exp_x, scale;
int ex_expt;
exp_x = __frexp_exp(x, &ex_expt);
expt += ex_expt;
INSERT_WORDS(scale, (0x3ff + expt) << 20, 0);
return (exp_x * scale);
}
-
-double complex
-__ldexp_cexp(double complex z, int expt)
-{
- double x, y, exp_x, scale1, scale2;
- int ex_expt, half_expt;
-
- x = creal(z);
- y = cimag(z);
- exp_x = __frexp_exp(x, &ex_expt);
- expt += ex_expt;
-
- /*
- * Arrange so that scale1 * scale2 == 2**expt. We use this to
- * compensate for scalbn being horrendously slow.
- */
- half_expt = expt / 2;
- INSERT_WORDS(scale1, (0x3ff + half_expt) << 20, 0);
- half_expt = expt - half_expt;
- INSERT_WORDS(scale2, (0x3ff + half_expt) << 20, 0);
-
- return (CMPLX(cos(y) * exp_x * scale1 * scale2,
- sin(y) * exp_x * scale1 * scale2));
-}

View File

@ -0,0 +1,29 @@
# HG changeset patch
# User Tooru Fujisawa <arai_a@mac.com>
# Date 1457079240 -32400
# Fri Mar 04 17:14:00 2016 +0900
# Node ID 61a88bbd6f42b7e35e6f5605da348da5d7bc57ed
# Parent 0e4d362b6f743a533805aeea9ff700a2de0e4490
Bug 933257 - Part 2.15: Include cfloat to use FLT_EVAL_METHOD.
diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h
--- a/modules/fdlibm/src/math_private.h
+++ b/modules/fdlibm/src/math_private.h
@@ -12,16 +12,17 @@
/*
* from: @(#)fdlibm.h 5.1 93/09/24
* $FreeBSD$
*/
#ifndef _MATH_PRIVATE_H_
#define _MATH_PRIVATE_H_
+#include <cfloat>
#include <stdint.h>
#include <sys/types.h>
#include "fdlibm.h"
#include "mozilla/Endian.h"
/*

View File

@ -0,0 +1,33 @@
# HG changeset patch
# User Tooru Fujisawa <arai_a@mac.com>
# Date 1457079240 -32400
# Fri Mar 04 17:14:00 2016 +0900
# Node ID 01acfb90ba766f1078ca3c91432e3e490f299c0d
# Parent 61a88bbd6f42b7e35e6f5605da348da5d7bc57ed
Bug 933257 - Part 2.16: Define u_int32_t and u_int64_t on Windows.
diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h
--- a/modules/fdlibm/src/math_private.h
+++ b/modules/fdlibm/src/math_private.h
@@ -33,16 +33,21 @@
* 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.
* Unlike the original code, we determine the endianness at compile
* time, not at run time; I don't see much benefit to selecting
* endianness at run time.
*/
+#ifdef WIN32
+#define u_int32_t uint32_t
+#define u_int64_t uint64_t
+#endif
+
/*
* A union which permits us to convert between a double and two 32 bit
* ints.
*/
#if MOZ_BIG_ENDIAN
typedef union

View File

@ -0,0 +1,39 @@
# HG changeset patch
# User Tooru Fujisawa <arai_a@mac.com>
# Date 1457079240 -32400
# Fri Mar 04 17:14:00 2016 +0900
# Node ID d1456e70e89c49c6b05ad3c2f1f9bf66050dc2fe
# Parent 01acfb90ba766f1078ca3c91432e3e490f299c0d
Bug 933257 - Part 2.17: Define STRICT_ASSIGN even if FLT_EVAL_METHOD is not defined.
diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h
--- a/modules/fdlibm/src/math_private.h
+++ b/modules/fdlibm/src/math_private.h
@@ -285,16 +285,27 @@ do { \
if (sizeof(type) >= sizeof(long double)) \
(lval) = (rval); \
else { \
__lval = (rval); \
(lval) = __lval; \
} \
} while (0)
#endif
+#else
+#define STRICT_ASSIGN(type, lval, rval) do { \
+ volatile type __lval; \
+ \
+ if (sizeof(type) >= sizeof(long double)) \
+ (lval) = (rval); \
+ else { \
+ __lval = (rval); \
+ (lval) = __lval; \
+ } \
+} while (0)
#endif /* FLT_EVAL_METHOD */
/* Support switching the mode to FP_PE if necessary. */
#if defined(__i386__) && !defined(NO_FPSETPREC)
#define ENTERI() \
long double __retval; \
fp_prec_t __oprec; \
\

View File

@ -0,0 +1,80 @@
# HG changeset patch
# User Tooru Fujisawa <arai_a@mac.com>
# Date 1457122688 -32400
# Sat Mar 05 05:18:08 2016 +0900
# Node ID 47b64370468532574e5be4db3cfb5f8415ba7c53
# Parent d1456e70e89c49c6b05ad3c2f1f9bf66050dc2fe
Bug 933257 - Part 2.18: Do not use hexadecimal floating point number.
diff --git a/modules/fdlibm/src/e_exp.cpp b/modules/fdlibm/src/e_exp.cpp
--- a/modules/fdlibm/src/e_exp.cpp
+++ b/modules/fdlibm/src/e_exp.cpp
@@ -146,14 +146,17 @@ double
if(k >= -1021)
INSERT_WORDS(twopk,0x3ff00000+(k<<20), 0);
else
INSERT_WORDS(twopk,0x3ff00000+((k+1000)<<20), 0);
c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5))));
if(k==0) return one-((x*c)/(c-2.0)-x);
else y = one-((lo-(x*c)/(2.0-c))-hi);
if(k >= -1021) {
- if (k==1024) return y*2.0*0x1p1023;
+ if (k==1024) {
+ double const_0x1p1023 = pow(2, 1023);
+ return y*2.0*const_0x1p1023;
+ }
return y*twopk;
} else {
return y*twopk*twom1000;
}
}
diff --git a/modules/fdlibm/src/e_rem_pio2.cpp b/modules/fdlibm/src/e_rem_pio2.cpp
--- a/modules/fdlibm/src/e_rem_pio2.cpp
+++ b/modules/fdlibm/src/e_rem_pio2.cpp
@@ -123,18 +123,19 @@ int
y[1] = (z-y[0])+4*pio2_1t;
return -4;
}
}
}
if(ix<0x413921fb) { /* |x| ~< 2^20*(pi/2), medium size */
medium:
/* Use a specialized rint() to get fn. Assume round-to-nearest. */
- STRICT_ASSIGN(double,fn,x*invpio2+0x1.8p52);
- fn = fn-0x1.8p52;
+ double const_0x1_8p52 = pow(2, 52) + pow(2, 51);
+ STRICT_ASSIGN(double,fn,x*invpio2+const_0x1_8p52);
+ fn = fn-const_0x1_8p52;
#ifdef HAVE_EFFICIENT_IRINT
n = irint(fn);
#else
n = (int32_t)fn;
#endif
r = x-fn*pio2_1;
w = fn*pio2_1t; /* 1st round good to 85 bit */
{
diff --git a/modules/fdlibm/src/s_expm1.cpp b/modules/fdlibm/src/s_expm1.cpp
--- a/modules/fdlibm/src/s_expm1.cpp
+++ b/modules/fdlibm/src/s_expm1.cpp
@@ -192,17 +192,20 @@ expm1(double x)
e -= hxs;
if(k== -1) return 0.5*(x-e)-0.5;
if(k==1) {
if(x < -0.25) return -2.0*(e-(x+0.5));
else return one+2.0*(x-e);
}
if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */
y = one-(e-x);
- if (k == 1024) y = y*2.0*0x1p1023;
+ if (k == 1024) {
+ double const_0x1p1023 = pow(2, 1023);
+ y = y*2.0*const_0x1p1023;
+ }
else y = y*twopk;
return y-one;
}
t = one;
if(k<20) {
SET_HIGH_WORD(t,0x3ff00000 - (0x200000>>k)); /* t=1-2^-k */
y = t-(e-x);
y = y*twopk;