Skip to content

Instantly share code, notes, and snippets.

@jvns
Created June 7, 2018 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jvns/e762245acb57b41727a095ecb558ff87 to your computer and use it in GitHub Desktop.
Save jvns/e762245acb57b41727a095ecb558ff87 to your computer and use it in GitHub Desktop.
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