## double abstract class

Representation of Dart doubles containing double specific constants and operations and specializations of operations inherited from num.

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

```abstract class double extends num {
static const double NAN = 0.0 / 0.0;
static const double INFINITY = 1.0 / 0.0;
static const double NEGATIVE_INFINITY = -INFINITY;
static const double MIN_POSITIVE = 5e-324;
static const double MAX_FINITE = 1.7976931348623157e+308;

double remainder(num other);

double operator +(num other);

/** Subtraction operator. */
double operator -(num other);

/** Multiplication operator. */
double operator *(num other);

double operator %(num other);

/** Division operator. */
double operator /(num other);

/**
* Truncating division operator.
*
* The result of the truncating division [:a ~/ b:] is equivalent to
* [:(a / b).truncate():].
*/
int operator ~/(num other);

/** Negate operator. */
double operator -();

/** Returns the absolute value of this [double]. */
double abs();

/**
* Returns the integer closest to `this`.
*
* Rounds away from zero when there is no closest integer:
*  [:(3.5).round() == 4:] and [:(-3.5).round() == -4:].
*
* If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError].
*/
int round();

/**
* Returns the greatest integer no greater than `this`.
*
* If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError].
*/
int floor();

/**
* Returns the least integer no smaller than `this`.
*
* If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError].
*/
int ceil();

/**
* Returns the integer obtained by discarding any fractional
* digits from `this`.
*
* If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError].
*/
int truncate();

/**
* Returns the integer value, as a double, closest to `this`.
*
* Rounds away from zero when there is no closest integer:
*  [:(3.5).round() == 4:] and [:(-3.5).round() == -4:].
*/
double roundToDouble();

/**
* Returns the greatest integer value no greater than `this`.
*
* The result is a double.
*/
double floorToDouble();

/**
* Returns the least integer value no smaller than `this`.
*
* The result is a double.
*/
double ceilToDouble();

/**
* Returns the integer obtained by discarding any fractional
* digits from `this`.
*
* The result is a double.
*/
double truncateToDouble();

/**
* Provide a representation of this [double] value.
*
* The representation is a number literal such that the closest double value
* to the representation's mathematical value is this [double].
*
* Returns "NaN" for the Not-a-Number value.
* Returns "Infinity" and "-Infinity" for positive and negative Infinity.
* Returns "-0.0" for negative zero.
*
* It should always be the case that if [:d:] is a [double], then
* [:d == double.parse(d.toString()):].
*/
String toString();

/**
* Parse [source] as an double literal and return its value.
*
* Accepts an optional sign (`+` or `-`) followed by either the characters
* "Infinity", the characters "NaN" or a floating-point representation.
* A floating-point representation is composed of a mantissa and an optional
* exponent part. The mantissa is either a decimal point (`.`) followed by a
* sequence of (decimal) digits, or a sequence of digits
* optionally followed by a decimal point and optionally more digits. The
* (optional) exponent part consists of the character "e" or "E", an optional
* sign, and one or more digits.
*
* The input string is trimmed (see [String.trim]) before conversion.
*
* If the [source] is not a valid double literal, the [handleError]
* is called with the [source] as argument, and its return value is
* used instead. If no handleError is provided, a [FormatException]
* is thrown.
*
* Examples of accepted strings:
*
*     "3.14"
*     "  3.14 \xA0"
*     "0."
*     ".0"
*     "-1.e3"
*     "1234E+7"
*     "+.12e-9"
*     "-NaN"
*/
external static double parse(String source,
[double handleError(String source)]);
}
```

> double

### Static Properties

#### const doubleINFINITY#

```static const double INFINITY = 1.0 / 0.0
```

#### const doubleMAX_FINITE#

```static const double MAX_FINITE = 1.7976931348623157e+308
```

#### const doubleMIN_POSITIVE#

```static const double MIN_POSITIVE = 5e-324
```

#### const doubleNAN#

```static const double NAN = 0.0 / 0.0
```

#### const doubleNEGATIVE_INFINITY#

```static const double NEGATIVE_INFINITY = -INFINITY
```

### Static Methods

#### doubleparse(String source, [double handleError(String source)]) #

Parse source as an double literal and return its value.

Accepts an optional sign (`+` or `-`) followed by either the characters "Infinity", the characters "NaN" or a floating-point representation. A floating-point representation is composed of a mantissa and an optional exponent part. The mantissa is either a decimal point (`.`) followed by a sequence of (decimal) digits, or a sequence of digits optionally followed by a decimal point and optionally more digits. The (optional) exponent part consists of the character "e" or "E", an optional sign, and one or more digits.

The input string is trimmed (see String.trim) before conversion.

If the source is not a valid double literal, the handleError is called with the source as argument, and its return value is used instead. If no handleError is provided, a FormatException is thrown.

Examples of accepted strings:

``````"3.14"
"  3.14 \xA0"
"0."
".0"
"-1.e3"
"1234E+7"
"+.12e-9"
"-NaN"
``````
```external static double parse(String source,
[double handleError(String source)]);
```

### Properties

#### final boolisInfinite#

inherited from num
```bool get isInfinite;
```

#### final boolisNaN#

inherited from num
```bool get isNaN;
```

#### final boolisNegative#

inherited from num
```bool get isNegative;
```

### Operators

Negate operator.

#### abstract doubleoperator -(num other) #

Subtraction operator.

#### abstract doubleoperator *(num other) #

Multiplication operator.

#### abstract doubleoperator /(num other) #

Division operator.

#### abstract intoperator ~/(num other) #

Truncating division operator.

The result of the truncating division `a ~/ b` is equivalent to `(a / b).truncate()`.

#### abstract doubleoperator %(num other) #

Euclidean modulo operator.

Returns the remainder of the euclidean division. The euclidean division of two integers `a` and `b` yields two integers `q` and `r` such that `a == b*q + r` and `0 <= r < a.abs()`.

The euclidean division is only defined for integers, but can be easily extended to work with doubles. In that case `r` may have a non-integer value, but it still verifies `0 <= r < |a|`.

The sign of the returned value `r` is always positive.

See remainder for the remainder of the truncating division.

docs inherited from num

#### abstract booloperator <(num other) #

inherited from num

Relational less than operator.

#### abstract booloperator <=(num other) #

inherited from num

Relational less than or equal operator.

#### abstract booloperator >(num other) #

inherited from num

Relational greater than operator.

#### abstract booloperator >=(num other) #

inherited from num

Relational greater than or equal operator.

### Methods

#### abstract doubleabs() #

Returns the absolute value of this double.

#### abstract intceil() #

Returns the least integer no smaller than `this`.

If `this` is not finite (`NaN` or infinity), throws an UnsupportedError.

#### abstract doubleceilToDouble() #

Returns the least integer value no smaller than `this`.

The result is a double.

#### abstract numclamp(num lowerLimit, num upperLimit) #

inherited from num

Clamps `this` to be in the range lowerLimit- upperLimit. The comparison is done using `compareTo` and therefore takes `-0.0` into account. It also implies that double.NAN is treated as the maximal double value.

#### abstract intcompareTo(T other) #

inherited from Comparable

Compares this object to another Comparable

Returns a value like a Comparator when comparing `this` to other.

May throw an ArgumentError if other is of a type that is not comparable to `this`.

#### abstract intfloor() #

Returns the greatest integer no greater than `this`.

If `this` is not finite (`NaN` or infinity), throws an UnsupportedError.

#### abstract doublefloorToDouble() #

Returns the greatest integer value no greater than `this`.

The result is a double.

#### abstract doubleremainder(num other) #

Returns the remainder of the truncating division of `this` by other.

The result `r` of this operation satisfies: `this == this ~/ other + r`. As a consequence the remainder `r` has the same sign as the dividend `this`.

docs inherited from num

#### abstract intround() #

Returns the integer closest to `this`.

Rounds away from zero when there is no closest integer: `(3.5).round() == 4` and `(-3.5).round() == -4`.

If `this` is not finite (`NaN` or infinity), throws an UnsupportedError.

#### abstract doubleroundToDouble() #

Returns the integer value, as a double, closest to `this`.

Rounds away from zero when there is no closest integer: `(3.5).round() == 4` and `(-3.5).round() == -4`.

#### abstract doubletoDouble() #

inherited from num

Return this num as a double.

If the number is not representable as a double, an approximation is returned. For numerically large integers, the approximation may be infinite.

#### abstract inttoInt() #

inherited from num

Truncates this num to an integer and returns the result as an int.

#### abstract StringtoString() #

Provide a representation of this double value.

The representation is a number literal such that the closest double value to the representation's mathematical value is this double.

Returns "NaN" for the Not-a-Number value. Returns "Infinity" and "-Infinity" for positive and negative Infinity. Returns "-0.0" for negative zero.

It should always be the case that if `d` is a double, then `d == double.parse(d.toString())`.

#### abstract StringtoStringAsExponential([int fractionDigits]) #

inherited from num

Converts `this` to a double and then gives a string in decimal exponential notation with fractionDigits digits after the decimal point.

If fractionDigits is given then it must be an integer satisfying: `0 <= fractionDigits <= 20`. Without the parameter the returned string uses the shortest number of digits that accurately represent `this`.

#### abstract StringtoStringAsFixed(int fractionDigits) #

inherited from num

Converts `this` to a double and then gives string representation with fractionDigits digits after the decimal point.

The parameter fractionDigits must be an integer satisfying: `0 <= fractionDigits <= 20`.

#### abstract StringtoStringAsPrecision(int precision) #

inherited from num

Converts `this` to a double and gives a string representation with precision significant digits.

The parameter precision must be an integer satisfying: `1 <= precision <= 21`.

#### abstract inttruncate() #

Returns the integer obtained by discarding any fractional digits from `this`.

If `this` is not finite (`NaN` or infinity), throws an UnsupportedError.

#### abstract doubletruncateToDouble() #

Returns the integer obtained by discarding any fractional digits from `this`.

The result is a double.