This file contains 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
function isSpecialCase(exponent, bias) { | |
return exponent == (bias << 1) + 1 | |
} | |
function handleSpecialCases(significand, signal) { | |
if (significand) { | |
return NaN; | |
} else if (signal) { | |
return -Infinity; | |
} else { |
This file contains 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
// The original: | |
function doMath(bias, significand, signal, exponent) { | |
return exponent == (bias << 1) + 1 | |
? significand | |
? NaN | |
: signal | |
? -Infinity | |
: +Infinity | |
: (1 + signal * -2) * |