Skip to content
CShift0.32

double

Struct · built-in type

struct double : IComparable<double>, IEquatable<double>, IHashable

A 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.

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.
static double MinValue

The smallest (most negative) finite value.

static double MaxValue

The largest finite value.

static double Epsilon

The 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.

static double PositiveInfinity

Positive infinity, e.g. the result of 1.0 / 0.0.

static double NegativeInfinity

Negative infinity.

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.
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, P or G, optionally followed by up to two digits.
bool Equals(double other)

Whether the numbers are equal (also a == b; NaN is not equal to NaN).

int CompareTo(double other)

Compares the numbers: -1, 0 or 1.

int GetHashCode()

A hash code of the number, for Dictionary keys.