Skip to content

Instantly share code, notes, and snippets.

@jvns

jvns/examineNaN.js

Created Jun 7, 2018
Embed
What would you like to do?
function examineNaN(x) {
const buf = new ArrayBuffer(8);
const view = new DataView(buf);
view.setFloat64(0, x);
let binStr = '';
for (let i = 0; i < 8; i++) {
binStr += ('00000000' + view.getUint8(i).toString(2)).slice(-8) + ' ';
}
return binStr
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment