aboutsummaryrefslogtreecommitdiff
path: root/src/preamble.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/preamble.js')
-rw-r--r--src/preamble.js17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/preamble.js b/src/preamble.js
index c88e4052..3e76e503 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -1074,11 +1074,16 @@ Math['imul'] = function imul(a, b) {
#endif
Math.imul = Math['imul'];
-#if TO_FLOAT32
-if (!Math['toFloat32']) Math['toFloat32'] = function toFloat32(x) {
- return x;
-};
-Math.toFloat32 = Math['toFloat32'];
+#if PRECISE_F32
+#if PRECISE_F32 == 1
+if (!Math['fround']) {
+ var froundBuffer = new Float32Array(1);
+ Math['fround'] = function(x) { froundBuffer[0] = x; return froundBuffer[0] };
+}
+#else // 2
+if (!Math['fround']) Math['fround'] = function(x) { return x };
+#endif
+Math.fround = Math['fround'];
#endif
var Math_abs = Math.abs;
@@ -1096,7 +1101,7 @@ var Math_ceil = Math.ceil;
var Math_floor = Math.floor;
var Math_pow = Math.pow;
var Math_imul = Math.imul;
-var Math_toFloat32 = Math.toFloat32;
+var Math_fround = Math.fround;
var Math_min = Math.min;
// A counter of dependencies for calling run(). If we need to