Methods
(static) floatEqual(d1, d2, maxdiff) → {boolean}
- Source:
Correctly compare two numbers with decimals.
Parameters:
Name | Type | Description |
---|---|---|
d1 |
number | |
d2 |
number | |
maxdiff |
number |
Returns:
true if the two doubles are different by less than maxdiff
- Type
- boolean
(static) round(num, places) → {number}
- Source:
Round a number to a specific number of decimal places.
Parameters:
Name | Type | Description |
---|---|---|
num |
number | the number to be rounded |
places |
number | the number of decimal places |
Returns:
the rounded number
- Type
- number
(static) roundDown(n, p) → {number}
- Source:
Round a number down to the nearest p decimal places.
Parameters:
Name | Type | Description |
---|---|---|
n |
number | the number to be rounded |
p |
number | the number of decimal places |
Returns:
the rounded number
- Type
- number
(static) roundUp(n, p) → {number}
- Source:
Round a number up to the nearest p decimal places.
Parameters:
Name | Type | Description |
---|---|---|
n |
number | the number to be rounded |
p |
number | the number of decimal places |
Returns:
the rounded number
- Type
- number