Skip to content

Instantly share code, notes, and snippets.

@diegoaguilar
Last active August 29, 2015 14:27
Show Gist options
  • Save diegoaguilar/46f7fc285f1a37c35ec1 to your computer and use it in GitHub Desktop.
Save diegoaguilar/46f7fc285f1a37c35ec1 to your computer and use it in GitHub Desktop.
Dividing x by Math.pow(10, n) shifts x by n digits to the right: 123123123 / 10^10 = 0.0123123123,
that way you can turn any number between 0 and 10^n-1 into a value between 0 and 1.
Subtracting it from 1 reverses the order, so that older is smaller (so results in a better rank value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment