Skip to content

Instantly share code, notes, and snippets.

@qntm
Last active October 16, 2022 00:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qntm/18f6c99e3f4b4f294af54463d0fbd161 to your computer and use it in GitHub Desktop.
Save qntm/18f6c99e3f4b4f294af54463d0fbd161 to your computer and use it in GitHub Desktop.
Get in, loser, we're iterating over every 64-bit float
const nextafter = require('nextafter')
for (let i = -Infinity; i !== Infinity; i = nextafter(i, Infinity)) {
console.log(i)
}
// Whoops, forgot a few the first time I ran this
console.log(Infinity)
console.log(NaN)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment