double
Struct · built-in type
struct double : IComparable<double>, IEquatable<double>, IHashableA 64-bit floating point number (IEEE 754 double precision); float64 is the same type.
Floating point arithmetic is not checked: it gives infinity or NaN instead of a panic.
Static fields
Section titled “Static fields”| Name | Description |
|---|---|
MinValue |
The smallest (most negative) finite value. |
MaxValue |
The largest finite value. |
Epsilon |
The difference between 1 and the next larger value. |
NaN |
“Not a number”, e.g. the result of 0.0 / 0.0; it is not equal to anything, not even to itself. |
PositiveInfinity |
Positive infinity, e.g. the result of 1.0 / 0.0. |
NegativeInfinity |
Negative infinity. |
MinValue
Section titled “MinValue”static double MinValueThe smallest (most negative) finite value.
MaxValue
Section titled “MaxValue”static double MaxValueThe largest finite value.
Epsilon
Section titled “Epsilon”static double EpsilonThe difference between 1 and the next larger value.
static double NaN“Not a number”, e.g. the result of 0.0 / 0.0; it is not equal to anything, not even to itself.
PositiveInfinity
Section titled “PositiveInfinity”static double PositiveInfinityPositive infinity, e.g. the result of 1.0 / 0.0.
NegativeInfinity
Section titled “NegativeInfinity”static double NegativeInfinityNegative infinity.
Methods
Section titled “Methods”| Name | Description |
|---|---|
ToString |
The number as text, with as many digits as needed to read it back exactly: 0.1.ToString() is "0.1". |
Equals |
Whether the numbers are equal (also a == b; NaN is not equal to NaN). |
CompareTo |
Compares the numbers: -1, 0 or 1. |
GetHashCode |
A hash code of the number, for Dictionary keys. |
ToString
Section titled “ToString”string ToString()The number as text, with as many digits as needed to read it back exactly: 0.1.ToString() is "0.1".
string ToString(string format)The number in a number format: 3.14159.ToString("F2") is "3.14" (see NumberFormat).
Parameters
format:F,N,E,PorG, optionally followed by up to two digits.
Equals
Section titled “Equals”bool Equals(double other)Whether the numbers are equal (also a == b; NaN is not equal to NaN).
CompareTo
Section titled “CompareTo”int CompareTo(double other)Compares the numbers: -1, 0 or 1.
GetHashCode
Section titled “GetHashCode”int GetHashCode()A hash code of the number, for Dictionary keys.