Created
January 27, 2022 09:13
-
-
Save sjrd/9b685abad5184d26cc0670fb25bef7fe 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
var $fround = (Math.fround || (((typeof Float32Array) !== "undefined") ? (function(v) { | |
var array = new Float32Array(1); | |
array[0] = v; | |
return array[0] | |
}) : (function(v) { | |
if (((v !== v) || (v === 0))) { | |
return v | |
}; | |
var isNegative = (v < 0); | |
var av = (isNegative ? (-v) : v); | |
var absResult; | |
if ((av >= 3.4028235677973366E38)) { | |
absResult = Infinity | |
} else if ((av >= 1.1754943508222875E-38)) { | |
var e = Math.floor((Math.log(av) / 0.6931471805599453)); | |
var twoPowE = Math.pow(2, e); | |
var significand = (av / twoPowE); | |
if ((significand < 1)) { | |
twoPowE = (twoPowE / 2); | |
significand = (significand * 2) | |
} else if ((significand >= 2)) { | |
twoPowE = (twoPowE * 2); | |
significand = (significand / 2) | |
}; | |
absResult = (((significand * 4.144523E-317) / 4.144523E-317) * twoPowE) | |
} else { | |
absResult = ((av * 3.5257702653609953E-279) / 3.5257702653609953E-279) | |
}; | |
return (isNegative ? (-absResult) : absResult) | |
}))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment