Math class

Common mathematical functions and constants.

Available Extensions

Constructors

Math()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

e double
Base of the natural logarithms (Euler's number).
no setter
ln10 double
Natural logarithm of 10.
no setter
ln2 double
Natural logarithm of 2.
no setter
log10E double
Base-10 logarithm of e.
no setter
log2E double
Base-2 logarithm of e.
no setter
pi double
The PI constant.
no setter
sqrt2 double
Square root of 2.
no setter
sqrtHalf double
Square root of 1/2.
no setter

Static Methods

abs<T extends num>(T a) → T
Returns the Absolute value of a.
acos(num x) double
asin(num x) double
atan(num x) double
atan2(num a, num b) double
ceil(num a) num
Returns the smallest (closest to negative infinity) value that is greater than or equal to the argument a and is equal to a mathematical integer.
clamp<T extends num>(T n, T min, T max) → T
Returns n bounded into the inclusive range min to max.
cos(num radians) double
divide(Iterable<num> ns) double
Divide in sequence ns entries.
exp(num x) double
floor(num a) num
Returns the largest (closest to positive infinity) double value that is less than or equal to the argument a and is equal to a mathematical integer.
hasNaN(Iterable<num> ns) bool
If ns has a NaN value.
log(num x) double
max<T extends num>(T a, T b) → T
Returns the larger of two numbers.
maxInList<T>(Iterable<T>? ns, [Comparator<T>? comparator]) → T?
Maximum value in ns entries.
mean(Iterable<num> ns) double
Mean value of ns entries.
min<T extends num>(T a, T b) → T
Returns the lesser of two numbers.
minInList<T>(Iterable<T>? ns, [Comparator<T>? comparator]) → T?
Minimal value of ns entries.
minMax<T>(Iterable<T>? ns, [Comparator<T>? comparator]) Pair<T>?
A pair with minimum and maximum value of ns entries.
multiply(Iterable<num> ns) double
Multiply in sequence ns entries.
pow(num x, num exponent) num
random() double
Global random generator.
round(num a) num
Returns the closest int to the argument a, with ties rounding to positive infinity.
sin(num radians) double
sqrt(num x) double
standardDeviation(Iterable<num> ns, [num? mean]) double
Standard deviation of ns entries.
subtract(Iterable<num> ns) double
Subtract in sequence ns entries.
sum(Iterable<num> ns) double
Sum value of ns entries.
tan(num radians) double