GODPAPER | All Packages | All Classes | Index | Frames No Frames |
Package

Public Methods

| Function | Defined By
--- | --- | ---
|  | clamp(value:Number, minimum:Number, maximum:Number):Number Forces a numeric value into a specified range. | feathers.utils.math
|  | roundDownToNearest(number:Number, nearest:Number = 1):Number Rounds a Number down to the nearest multiple of an input. | feathers.utils.math
|  | roundToNearest(number:Number, nearest:Number = 1):Number Rounds a Number to the nearest multiple of an input. | feathers.utils.math
|  | roundToPrecision(number:Number, precision:int = 0):Number Rounds a number to a certain level of precision. | feathers.utils.math
|  | roundUpToNearest(number:Number, nearest:Number = 1):Number Rounds a Number up to the nearest multiple of an input. | feathers.utils.math

Function detail

clamp | () | function

`public function clamp(value:Number, minimum:Number, maximum:Number):Number`

Forces a numeric value into a specified range.

Parameters

| `value:Number` — The value to force into the range.
| `minimum:Number` — The minimum bound of the range.
| `maximum:Number` — The maximum bound of the range.

Returns

| `Number` — A value within the specified range.

roundDownToNearest | () | function |

`public function roundDownToNearest(number:Number, nearest:Number = 1):Number`

Rounds a Number down to the nearest multiple of an input. For example, by rounding 16 down to the nearest 10, you will receive 10. Similar to the built-in function Math.floor().

Parameters

| `number:Number` — the number to round down
| `nearest:Number` (default = `1`)`` — the number whose mutiple must be found

Returns

| `Number` — the rounded number

See also

Math.floor

roundToNearest | () | function |

`public function roundToNearest(number:Number, nearest:Number = 1):Number`

Rounds a Number to the nearest multiple of an input. For example, by rounding 16 to the nearest 10, you will receive 20. Similar to the built-in function Math.round().

Parameters

| `number:Number` — the number to round
| `nearest:Number` (default = `1`)`` — the number whose mutiple must be found

Returns

| `Number` — the rounded number

See also

Math.round

roundToPrecision | () | function |

`public function roundToPrecision(number:Number, precision:int = 0):Number`

Rounds a number to a certain level of precision. Useful for limiting the number of decimal places on a fractional number.

Parameters

| `number:Number` — the input number to round.
| `precision:int` (default = `0`)`` — the number of decimal digits to keep

Returns

| `Number` — the rounded number, or the original input if no rounding is needed

See also

Math.round

roundUpToNearest | () | function |

`public function roundUpToNearest(number:Number, nearest:Number = 1):Number`

Rounds a Number up to the nearest multiple of an input. For example, by rounding 16 up to the nearest 10, you will receive 20. Similar to the built-in function Math.ceil().

Parameters

| `number:Number` — the number to round up
| `nearest:Number` (default = `1`)`` — the number whose mutiple must be found

Returns

| `Number` — the rounded number

See also

Math.ceil

Thu Jan 16 2014, 01:13 PM +08:00