ObjNumExt extension

on

Properties

isFinite bool
Whether this number is finite.
no setter
isInfinite bool
Whether this number is positive infinity or negative infinity.
no setter
isNaN bool
Whether this number is a Not-a-Number value.
no setter
isNegative bool
Whether this number is negative.
no setter
sign num
Negative one, zero or positive one depending on the sign and numerical value of this number.
no setter

Methods

abs() num
The absolute value of this number.
ceil() int
The least integer no smaller than this.
ceilToDouble() double
Returns the least double integer value no smaller than this.
clamp(num lowerLimit, num upperLimit) num
Returns this num clamped to be in the range lowerLimit-upperLimit.
compareTo(num other) int
Compares this to other.
floor() int
The greatest integer no greater than this number.
floorToDouble() double
Returns the greatest double integer value no greater than this.
remainder(num other) num
The remainder of the truncating division of this by other.
round() int
The integer closest to this number.
roundToDouble() double
The double integer value closest to this value.
toDouble() double
This number as a double.
toInt() int
Truncates this num to an integer and returns the result as an int.
toStringAsExponential([int? fractionDigits]) String
An exponential string-representation of this number.
toStringAsFixed(int fractionDigits) String
A decimal-point string-representation of this number.
toStringAsPrecision(int precision) String
A string representation with precision significant digits.
truncate() int
The integer obtained by discarding any fractional digits from this.
truncateToDouble() double
Returns the double integer value obtained by discarding any fractional digits from the double value of this.

Operators

operator %(Obj<num> other) Obj<num>
Euclidean modulo of this number by other.
operator *(Obj<num> other) Obj<num>
Multiplies this number by other.
operator +(Obj<num> other) Obj<num>
Adds other to this number.
operator -(Obj<num> other) Obj<num>
Subtracts other from this number.
operator /(Obj<num> other) Obj<double>
Divides this number by other.
operator <(Obj<num> other) bool
Whether this number is numerically smaller than other.
operator <=(Obj<num> other) bool
Whether this number is numerically smaller than or equal to other.
operator >(Obj<num> other) bool
Whether this number is numerically greater than other.
operator >=(Obj<num> other) bool
Whether this number is numerically greater than or equal to other.
operator unary-() Obj<num>
The negation of this value.
operator ~/(Obj<num> other) Obj<int>
Truncating division operator.