Skip to content

Instantly share code, notes, and snippets.

@alexcrichton
Created September 2, 2017 06:06
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 alexcrichton/c49d960f631fcb78e1fcb53c79e8fe91 to your computer and use it in GitHub Desktop.
Save alexcrichton/c49d960f631fcb78e1fcb53c79e8fe91 to your computer and use it in GitHub Desktop.
function out(arg) {
document.getElementById('output').innerHTML += arg + "\n";
}
function test(a, ty) {
a[0] = 257.0;
out(' 257.0 -> ' + ty + ' = ' + a[0]);
a[0] = -257.0;
out('-257.0 -> ' + ty + ' = ' + a[0]);
a[0] = 2147483648.0;
out(' MAX+1 -> ' + ty + ' = ' + a[0]);
a[0] = -2147483649.0;
out(' MIN-1 -> ' + ty + ' = ' + a[0]);
a[0] = -0.0;
out('-0.0 -> ' + ty + ' = ' + a[0]);
a[0] = 1.0/0.0;
out(' Inf -> ' + ty + ' = ' + a[0]);
a[0] = -1.0/0.0;
out('-Inf -> ' + ty + ' = ' + a[0]);
a[0] = 0.0/0.0;
out(' NaN -> ' + ty + ' = ' + a[0]);
}
test(new Int32Array(1), 'i32');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment