Math

The Math namespace contains a couple of helpful functions related to precision of number variables.
Format
// Round and format number as string - 3rd argument is optional
var strValue = Fit.Math.Format(123.45678, 2); // Returns "123.46"
var strValue = Fit.Math.Format(123, 3, ","); // Returns "123,000"


Round
// Round and return as number - 2nd argument is optional
Fit.Math.Round(12); // Returns 12
Fit.Math.Round(12.4); // Returns 12
Fit.Math.Round(12.5); // Returns 13
Fit.Math.Round(12.5869, 2); // Returns 12.59
Fit.UI is open source (LGPL) - download or fork it on GitHub - website powered by Sitemagic CMS