NumMoreExtensions extension

Number More: clamp non-negative, isInteger, round half up, truncate decimals, percentage, degrees/radians, etc. Roadmap #311-325.

on

Properties

isInteger → bool

Available on num, provided by the NumMoreExtensions extension

Returns true if this number has no fractional part.
no setter

Methods

clampNonNegative() → int

Available on num, provided by the NumMoreExtensions extension

Returns this number rounded to the nearest int, with negatives clamped to 0.
percentageChangeFrom(num from) → double

Available on num, provided by the NumMoreExtensions extension

Returns the fractional change from from to this value.
percentageOf(num total) → double

Available on num, provided by the NumMoreExtensions extension

Returns this value as a fraction of total.
truncateToDecimals(int places) → double

Available on num, provided by the NumMoreExtensions extension

Truncates this number to places decimal places without rounding.