Class: SC.Math
Implements some enhancements to the built-in Number object that makes it easier to handle rounding and display of numbers.
Defined in: math.js
- Since:
- SproutCore 1.0
Instance Methods
Instance Method Detail
near(n1, n2, lambda)
Checks to see if the number is near the supplied parameter to a certain lambda.
- Parameters:
- n1 Number
- First number in comparison.
- n2 Number
- Number to compare against the first.
- lambda Number
- The closeness sufficient for a positive result. Default 0.00001
- Returns:
- Boolean
round(n, decimalPlace)
Rounds a number to a given decimal place. If a negative decimalPlace
parameter is provided, the number will be rounded outward (ie. providing
-3 will round to the thousands).
Function is insufficient for high negative values of decimalPlace
parameter.
For example, (123456.789).round(-5) should evaluate to 100000 but instead
evaluates to 99999.999...
- Parameters:
- n Number
- The number to round
- decimalPlace Integer
- Returns:
- Number
Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 08 2015 10:02:20 GMT-0600 (CST)