number
Provides nice extensions to the interface of basic numerical types, for convenience.
Attributes
- Graph
-
- Supertypes
- Self type
-
number.type
Members list
Extensions
Extensions
Produces a modulo while dealing nicely with negative values. myInt1 %% myInt2 is the remainder of the division myInt1 / myInt2 such that the division floors negative results away from zero rather than truncating them towards it. This has the effect that if myInt2 is positive, the result is always positive or zero.
Produces a modulo while dealing nicely with negative values. myInt1 %% myInt2 is the remainder of the division myInt1 / myInt2 such that the division floors negative results away from zero rather than truncating them towards it. This has the effect that if myInt2 is positive, the result is always positive or zero.
A typical use for this is when values (e.g., indices) need to be wrapped around to a zero-based range. For example, supposing size is positive, (myIndex + offset) %% size produces a valid index between 0 and size - 1, even if the sum is negative.
Attributes
num atLeast limit is equivalent to num.max(limit).
num atLeast limit is equivalent to num.max(limit).
Attributes
num atMost limit is equivalent to num.min(limit).
num atMost limit is equivalent to num.min(limit).
Attributes
num.clamp(low, high) is equivalent to num.max(low).min(high).
num.clamp(low, high) is equivalent to num.max(low).min(high).
Attributes
myInt1 ddiv myInt2 is equivalent tomyInt1 / myInt2.toDouble`.
myInt1 ddiv myInt2 is equivalent tomyInt1 / myInt2.toDouble`.
Attributes
Determines if the at least as large as low and less than high. Note that the lower bound is inclusive and the upper bound exclusive.
Determines if the at least as large as low and less than high. Note that the lower bound is inclusive and the upper bound exclusive.
Attributes
Determines if the integer is divisible by two.
Determines if the integer is divisible by two.
Attributes
num atLeast limit is equivalent to num.max(limit).
num atLeast limit is equivalent to num.max(limit).
Attributes
num atMost limit is equivalent to num.min(limit).
num atMost limit is equivalent to num.min(limit).
Attributes
num.clamp(low, high) is equivalent to num.max(low).min(high).
num.clamp(low, high) is equivalent to num.max(low).min(high).
Attributes
Determines if the at least as large as low and less than high. The lower bound is inclusive and the upper bound exclusive.
Determines if the at least as large as low and less than high. The lower bound is inclusive and the upper bound exclusive.
Attributes
num atLeast limit is equivalent to num.max(limit).
num atLeast limit is equivalent to num.max(limit).
Attributes
num atMost limit is equivalent to num.min(limit).
num atMost limit is equivalent to num.min(limit).
Attributes
num.clamp(low, high) is equivalent to num.max(low).min(high).
num.clamp(low, high) is equivalent to num.max(low).min(high).
Attributes
Determines if the at least as large as low and less than high. The lower bound is inclusive and the upper bound exclusive.
Determines if the at least as large as low and less than high. The lower bound is inclusive and the upper bound exclusive.
Attributes
num atLeast limit is equivalent to num.max(limit).
num atLeast limit is equivalent to num.max(limit).
Attributes
num atMost limit is equivalent to num.min(limit).
num atMost limit is equivalent to num.min(limit).
Attributes
num.clamp(low, high) is equivalent to num.max(low).min(high).
num.clamp(low, high) is equivalent to num.max(low).min(high).
Attributes
Determines if the at least as large as low and less than high. The lower bound is inclusive and the upper bound exclusive.
Determines if the at least as large as low and less than high. The lower bound is inclusive and the upper bound exclusive.
Attributes
Determines if the integer is divisible by two.
Determines if the integer is divisible by two.
