Created
August 18, 2011 10:48
-
-
Save mathiasbynens/1153826 to your computer and use it in GitHub Desktop.
Fun with v8’s Number#toString bug
This file contains hidden or 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
var number = 0, | |
increment = 0.00000000000001, // smallest value that makes a difference | |
result, | |
matches, | |
match; | |
for (; number < 100; number += increment) { | |
result = number.toString(33); | |
matches = result.match(/[a-z]+/g) || []; | |
match = matches.indexOf('wtf'); | |
if (match > -1) { | |
console.log('(' + number + ').toString(33).match(/[a-z]+/g)[' + match + ']; // ' + matches[match]); | |
} | |
} |
tomasdev
commented
Sep 14, 2012
897217487244305.0.toString(33) + " is super fun"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment