dart:math library

Mathematical constants and functions, plus a random number generator.

Mathematical constants and functions, plus a random number generator.

Classes

Point
A utility class for representing two-dimensional positions.
Random
A generator of random bool, int, or double values.
Rectangle
A class for representing two-dimensional rectangles whose properties are immutable.
MutableRectangle
A class for representing two-dimensional axis-aligned rectangles with mutable properties.

Constants

E = 2.718281828459045
Base of the natural logarithms.
LN10 = 2.302585092994046
Natural logarithm of 10.
LN2 = 0.6931471805599453
Natural logarithm of 2.
LOG2E = 1.4426950408889634
Base-2 logarithm of E.
LOG10E = 0.4342944819032518
Base-10 logarithm of E.
PI = 3.1415926535897932
The PI constant.
SQRT1_2 = 0.7071067811865476
Square root of 1/2.
SQRT2 = 1.4142135623730951
Square root of 2.

Functions

min ( num a, num b ) → num
Returns the lesser of two numbers.
max ( num a, num b ) → num
Returns the larger of two numbers.
atan2 ( num a, num b ) → double
A variant of atan.
pow ( num x, num exponent ) → num
Returns x to the power of exponent.
sin ( num x ) → double
Converts x to a double and returns the sine of the value.
cos ( num x ) → double
Converts x to a double and returns the cosine of the value.
tan ( num x ) → double
Converts x to a double and returns the tangent of the value.
acos ( num x ) → double
Converts x to a double and returns the arc cosine of the value.
asin ( num x ) → double
Converts x to a double and returns the arc sine of the value. Returns a value in the range -PI..PI, or NaN if x is outside the range -1..1.
atan ( num x ) → double
Converts x to a dobule and returns the arc tangent of the vlaue. Returns a value in the range -PI/2..PI/2, or NaN if x is NaN.
sqrt ( num x ) → double
Converts x to a double and returns the positive square root of the value.
exp ( num x ) → double
Converts x to a double and returns the natural exponent, E, to the power x. Returns NaN if x is NaN.
log ( num x ) → double
Converts x to a double and returns the natural logarithm of the value. Returns negative infinity if x is equal to zero. Returns NaN if x is NaN or less than zero.