Index: src/third_party/fdlibm/fdlibm.js |
diff --git a/src/third_party/fdlibm/fdlibm.js b/src/third_party/fdlibm/fdlibm.js |
index 3be7c08d84a5984d1b99a4e41302d8c7bafa04f7..82f50cc514096ca1ab8ccfb031e0240703e40eb3 100644 |
--- a/src/third_party/fdlibm/fdlibm.js |
+++ b/src/third_party/fdlibm/fdlibm.js |
@@ -26,26 +26,15 @@ |
var kMath; |
var rempio2result; |
-(function(global, utils) { |
+(function(global, shared, exports) { |
"use strict"; |
%CheckIsBootstrapping(); |
-// ------------------------------------------------------------------- |
-// Imports |
- |
var GlobalMath = global.Math; |
-var MathAbs; |
-var MathExp; |
- |
-utils.Import(function(from) { |
- MathAbs = from.MathAbs; |
- MathExp = from.MathExp; |
-}); |
- |
-// ------------------------------------------------------------------- |
+//------------------------------------------------------------------- |
define INVPIO2 = kMath[0]; |
define PIO2_1 = kMath[1]; |
@@ -98,7 +87,7 @@ |
} |
} else if (ix <= 0x413921fb) { |
// |X| ~<= 2^19*(pi/2), medium size |
- var t = MathAbs(X); |
+ var t = $abs(X); |
n = (t * INVPIO2 + 0.5) | 0; |
var r = t - n * PIO2_1; |
var w = n * PIO2_1T; |
@@ -280,7 +269,7 @@ |
if (ix < 0x3e300000) { // |x| < 2^-28 |
if (((ix | %_DoubleLo(x)) | (returnTan + 1)) == 0) { |
// x == 0 && returnTan = -1 |
- return 1 / MathAbs(x); |
+ return 1 / $abs(x); |
} else { |
if (returnTan == 1) { |
return x; |
@@ -768,7 +757,7 @@ |
x = x * 1; // Convert to number. |
var h = (x < 0) ? -0.5 : 0.5; |
// |x| in [0, 22]. return sign(x)*0.5*(E+E/(E+1)) |
- var ax = MathAbs(x); |
+ var ax = $abs(x); |
if (ax < 22) { |
// For |x| < 2^-28, sinh(x) = x |
if (ax < TWO_M28) return x; |
@@ -777,11 +766,11 @@ |
return h * (t + t / (t + 1)); |
} |
// |x| in [22, log(maxdouble)], return 0.5 * exp(|x|) |
- if (ax < LOG_MAXD) return h * MathExp(ax); |
+ if (ax < LOG_MAXD) return h * $exp(ax); |
// |x| in [log(maxdouble), overflowthreshold] |
// overflowthreshold = 710.4758600739426 |
if (ax <= KSINH_OVERFLOW) { |
- var w = MathExp(0.5 * ax); |
+ var w = $exp(0.5 * ax); |
var t = h * w; |
return t * w; |
} |
@@ -819,7 +808,7 @@ |
var ix = %_DoubleHi(x) & 0x7fffffff; |
// |x| in [0,0.5*log2], return 1+expm1(|x|)^2/(2*exp(|x|)) |
if (ix < 0x3fd62e43) { |
- var t = MathExpm1(MathAbs(x)); |
+ var t = MathExpm1($abs(x)); |
var w = 1 + t; |
// For |x| < 2^-55, cosh(x) = 1 |
if (ix < 0x3c800000) return w; |
@@ -827,14 +816,14 @@ |
} |
// |x| in [0.5*log2, 22], return (exp(|x|)+1/exp(|x|)/2 |
if (ix < 0x40360000) { |
- var t = MathExp(MathAbs(x)); |
+ var t = $exp($abs(x)); |
return 0.5 * t + 0.5 / t; |
} |
// |x| in [22, log(maxdouble)], return half*exp(|x|) |
- if (ix < 0x40862e42) return 0.5 * MathExp(MathAbs(x)); |
+ if (ix < 0x40862e42) return 0.5 * $exp($abs(x)); |
// |x| in [log(maxdouble), overflowthreshold] |
- if (MathAbs(x) <= KCOSH_OVERFLOW) { |
- var w = MathExp(0.5 * MathAbs(x)); |
+ if ($abs(x) <= KCOSH_OVERFLOW) { |
+ var w = $exp(0.5 * $abs(x)); |
var t = 0.5 * w; |
return t * w; |
} |
@@ -937,7 +926,7 @@ |
function MathLog2(x) { |
x = x * 1; // Convert to number. |
- var ax = MathAbs(x); |
+ var ax = $abs(x); |
var hx = %_DoubleHi(x); |
var lx = %_DoubleLo(x); |
var ix = hx & 0x7fffffff; |