double class Null safety

A double-precision floating point number.

Representation of Dart doubles containing double specific constants and operations and specializations of operations inherited from num. Dart doubles are 64-bit floating-point numbers as specified in the IEEE 754 standard.

The double type is contagious. Operations on doubles return double results.

It is a compile-time error for a class to attempt to extend or implement double.

See also:

Inheritance

Constructors

double()

Properties

hashCode int
Returns a hash code for a numerical value. [...]
read-only, inherited
isFinite bool
Whether this number is finite. [...]
read-only, inherited
isInfinite bool
Whether this number is positive infinity or negative infinity. [...]
read-only, inherited
isNaN bool
Whether this number is a Not-a-Number value. [...]
read-only, inherited
isNegative bool
Whether this number is negative. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
sign double
The sign of the double's numerical value. [...]
read-only, override

Methods

abs() double
The absolute value of this number. [...]
override
ceil() int
Returns the least integer that is not smaller than this number. [...]
override
ceilToDouble() double
Returns the least integer double value no smaller than this. [...]
override
clamp(num lowerLimit, num upperLimit) num
Returns this num clamped to be in the range lowerLimit-upperLimit. [...]
inherited
compareTo(num other) int
Compares this to other. [...]
inherited
floor() int
Returns the greatest integer no greater than this number. [...]
override
floorToDouble() double
Returns the greatest integer double value no greater than this. [...]
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
remainder(num other) double
The remainder of the truncating division of this by other. [...]
override
round() int
Returns the integer closest to this number. [...]
override
roundToDouble() double
Returns the integer double value closest to this. [...]
override
toDouble() double
This number as a double. [...]
inherited
toInt() int
Truncates this num to an integer and returns the result as an int. [...]
inherited
toString() String
Provide a representation of this double value. [...]
override
toStringAsExponential([int? fractionDigits]) String
An exponential string-representation of this number. [...]
inherited
toStringAsFixed(int fractionDigits) String
A decimal-point string-representation of this number. [...]
inherited
toStringAsPrecision(int precision) String
A string representation with precision significant digits. [...]
inherited
truncate() int
Returns the integer obtained by discarding any fractional part of this number. [...]
override
truncateToDouble() double
Returns the integer double value obtained by discarding any fractional digits from this. [...]
override

Operators

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

Static Methods

parse(String source, [double onError(String source)?]) double
Parse source as a double literal and return its value. [...]
override
tryParse(String source) double?
Parse source as a double literal and return its value. [...]
override

Constants

infinity → const double
1.0 / 0.0
maxFinite → const double
1.7976931348623157e+308
minPositive → const double
5e-324
nan → const double
0.0 / 0.0
negativeInfinity → const double
-infinity