MathUtils class

General math-related and numeric utility functions.

Constructors

MathUtils()

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 Methods

binarySearch(List<int> arr, int value, [int start = 0, int? end]) int
bitCount(int i) int
bitCount32(int i) int
distance(double aX, double aY, double bX, double bY) double
@param aX point A x coordinate @param aY point A y coordinate @param bX point B x coordinate @param bY point B y coordinate @return Euclidean distance between points A and B
isDigit(int ch) bool
numberOfLeadingZeros(int i) int
numberOfTrailingZeros(int i) int
round(double d) int
Ends up being a bit faster than {@link Math#round(double)}. This merely rounds its argument to the nearest int, where x.5 rounds up to x+1. Semantics of this shortcut differ slightly from {@link Math#round(double)} in that half rounds down for negative values. -2.5 rounds to -3, not -2. For purposes here it makes no difference.
sum(List<int> array) int
@param array values to sum @return sum of values in array

Constants

maxValue → const int
minValue → const int