Created
March 24, 2014 11:34
-
-
Save mraleph/9738601 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!Math.fround) { | |
Math.fround = (function() { | |
var temp = new Float32Array(1); | |
return function fround(x) { | |
temp[0] = +x; | |
return temp[0]; | |
} | |
})(); | |
} | |
// No such thing as FEPSILON in the ES6. I just put it on Number for consistency with Number.EPSILON which is ES6 | |
Number.FEPSILON = Number.FEPSILON || 1.192092896e-07; | |
Math.fround(0.4999999 + Number.FEPSILON) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment