Created
August 17, 2011 23:20
-
-
Save BrendanEich/1152895 to your computer and use it in GitHub Desktop.
typed array vs. number type
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
js> b = new ArrayBuffer(64) | |
({}) | |
js> a = new Uint32Array(b) | |
({0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0, 14:0, 15:0}) | |
js> a[0] | |
0 | |
js> a[0] = Math.pow(2,32) | |
4294967296 | |
js> a[0] | |
0 | |
js> a[0] = Math.pow(2,52) | |
4503599627370496 | |
js> a[0] | |
0 | |
js> a[0] = Math.pow(2,52)+1 | |
4503599627370497 | |
js> a[0] | |
1 | |
js> a[0] = Math.pow(2,53) | |
9007199254740992 | |
js> a[0] | |
0 | |
js> a[0] = Math.pow(2,53)+1 | |
9007199254740992 | |
js> a[0] | |
0 | |
js> a[0] = Math.pow(2,53)+2 | |
9007199254740994 | |
js> a[0] | |
2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Copy/paste glitch fixed. Hope this is clear enough now.
/be