Skip to content

Instantly share code, notes, and snippets.

@dr-dimitru
Created March 16, 2016 23:00
Show Gist options
  • Save dr-dimitru/e7941380efe34be1b1cb to your computer and use it in GitHub Desktop.
Save dr-dimitru/e7941380efe34be1b1cb to your computer and use it in GitHub Desktop.
Speed-test of trimming float number

Test trim-float

var x = 5.0364342423;
parseFloat(x.toFixed(2));
//VS
Math.round(x*100)/100; // 97% faster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment