Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
struct System.​Double
Assembly: System.Runtime
Represents a double-precision floating-point number.
Fields and Constants
public const
double
E
Represents the natural logarithmic base, specified by the constant, e.
public const
double
Epsilon
Represents the smallest positive <see cref="T:System.Double" /> value that is greater than zero. This field is constant.
public const
double
MaxValue
Represents the largest possible value of a <see cref="T:System.Double" /> . This field is constant.
public const
double
MinValue
Represents the smallest possible value of a <see cref="T:System.Double" /> . This field is constant.
public const
double
NaN
Represents a value that is not a number ( <see langword="NaN" /> ). This field is constant.
public const
double
NegativeInfinity
Represents negative infinity. This field is constant.
public const
double
NegativeZero
Represents the number negative zero (-0).
public const
double
Pi
Represents the ratio of the circumference of a circle to its diameter, specified by the constant, π.
public const
double
PositiveInfinity
Represents positive infinity. This field is constant.
public const
double
Tau
Represents the number of radians in one turn, specified by the constant, τ.
Methods
public
int
CompareTo​(double value)
value
A double-precision floating-point number to compare.
Returns A signed number indicating the relative values of this instance and <paramref name="value" /> .
<list type="table">
<listheader>
<term> Return Value</term>
<description> Description</description>
</listheader>
<item>
<term> Less than zero</term>
<description> This instance is less than <paramref name="value" />, or this instance is not a number (<see cref="F:System.Double.NaN" />) and <paramref name="value" /> is a number.</description>
</item>
<item>
<term> Zero</term>
<description> This instance is equal to <paramref name="value" />, or both this instance and <paramref name="value" /> are not a number (<see cref="F:System.Double.NaN" />), <see cref="F:System.Double.PositiveInfinity" />, or <see cref="F:System.Double.NegativeInfinity" />.</description>
</item>
<item>
<term> Greater than zero</term>
<description> This instance is greater than <paramref name="value" />, or this instance is a number and <paramref name="value" /> is not a number (<see cref="F:System.Double.NaN" />).</description>
</item>
</list>
Compares this instance to a specified double-precision floating-point number and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified double-precision floating-point number.
public
int
CompareTo​(object value)
value
An object to compare, or <see langword="null" /> .
Returns A signed number indicating the relative values of this instance and <paramref name="value" /> .
<list type="table">
<listheader>
<term> Value</term>
<description> Description</description>
</listheader>
<item>
<term> A negative integer</term>
<description> This instance is less than <paramref name="value" />, or this instance is not a number (<see cref="F:System.Double.NaN" />) and <paramref name="value" /> is a number.</description>
</item>
<item>
<term> Zero</term>
<description> This instance is equal to <paramref name="value" />, or this instance and <paramref name="value" /> are both <see langword="Double.NaN" />, <see cref="F:System.Double.PositiveInfinity" />, or <see cref="F:System.Double.NegativeInfinity" /></description>
</item>
<item>
<term> A positive integer</term>
<description> This instance is greater than <paramref name="value" />, OR this instance is a number and <paramref name="value" /> is not a number (<see cref="F:System.Double.NaN" />), OR <paramref name="value" /> is <see langword="null" />.</description>
</item>
</list>
Compares this instance to a specified object and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified object.
public
bool
Equals​(double obj)
obj
A <see cref="T:System.Double" /> object to compare to this instance.
Returns <see langword="true" /> if <paramref name="obj" /> is equal to this instance; otherwise, <see langword="false" /> .
Returns a value indicating whether this instance and a specified <see cref="T:System.Double" /> object represent the same value.
public
bool
Equals​(object obj)
obj
An object to compare with this instance.
Returns <see langword="true" /> if <paramref name="obj" /> is an instance of <see cref="T:System.Double" /> and equals the value of this instance; otherwise, <see langword="false" /> .
Returns a value indicating whether this instance is equal to a specified object.
public
int
GetHashCode​() Returns A 32-bit signed integer hash code.
Returns the hash code for this instance.
public
TypeCode
GetTypeCode​() Returns The enumerated constant, <see cref="F:System.TypeCode.Double" /> .
Returns the <see cref="T:System.TypeCode" /> for value type <see cref="T:System.Double" /> .
public
string
ToString​() Returns The string representation of the value of this instance.
Converts the numeric value of this instance to its equivalent string representation.
public
string
ToString​(IFormatProvider provider)
provider
An object that supplies culture-specific formatting information.
Returns The string representation of the value of this instance as specified by <paramref name="provider" /> .
Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information.
public
string
ToString​(string format)
format
A numeric format string.
Returns The string representation of the value of this instance as specified by <paramref name="format" /> .
Converts the numeric value of this instance to its equivalent string representation, using the specified format.
public
string
ToString​(string format,
IFormatProvider provider)
format
A numeric format string.
provider
An object that supplies culture-specific formatting information.
Returns The string representation of the value of this instance as specified by <paramref name="format" /> and <paramref name="provider" /> .
Converts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information.
public
bool
TryFormat​(Span`1 utf8Destination,
Int32& bytesWritten,
ReadOnlySpan`1 format = null,
IFormatProvider provider = null)
public
bool
TryFormat​(Span`1 destination,
Int32& charsWritten,
ReadOnlySpan`1 format = null,
IFormatProvider provider = null)
protected
void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public
Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected
object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates a shallow copy of the current <see cref="T:System.Object" /> .