Skip to content

Instantly share code, notes, and snippets.

@AWaselnuk
Last active August 29, 2015 14:07
Show Gist options
  • Save AWaselnuk/a1493c54460b8538127a to your computer and use it in GitHub Desktop.
Save AWaselnuk/a1493c54460b8538127a to your computer and use it in GitHub Desktop.
Rounding floats to a given precision.
# From: http://www.jacklmoore.com/notes/rounding-in-javascript/
round = (value, decimals) ->
Number(Math.round(value + 'e' + decimals) + 'e-' + decimals)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment