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.​Half
Assembly: System.Runtime
Represents a half-precision floating-point number.
Methods
public
int
CompareTo​(Half other)
other
A half-precision floating-point number to compare.
Returns A value less than zero if this is less than <paramref name="other" /> , zero if this is equal to <paramref name="other" /> , or a value greater than zero if this is greater than <paramref name="other" /> .
Compares this instance to a specified half-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 half-precision floating-point number.
public
int
CompareTo​(object obj)
obj
An object to compare, or <see langword="null" /> .
Returns A value less than zero if this instance is less than <paramref name="obj" /> , or this instance is not a number (NaN) and <paramref name="obj" /> is a number.
-or-
Zero if this instance is equal to <paramref name="obj" /> , or this instance and <paramref name="obj" /> are both not a number (NaN), <see cref="P:System.Half.PositiveInfinity" /> , or <see cref="P:System.Half.NegativeInfinity" /> .
-or-
A value greater than zero if this instance is greater than <paramref name="obj" /> , or this instance is a number and <paramref name="obj" /> is not a number (NaN), or <paramref name="obj" /> is <see langword="null" /> .
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​(Half other)
other
A half-precision floating point number to compare to this instance.
Returns <see langword="true" /> if the current object is equal to <paramref name="other" /> ; otherwise, <see langword="false" /> .
Compares this instance for equality with <paramref name="other" /> .
public
bool
Equals​(object obj)
obj
The object to compare to this instance.
Returns <see langword="true" /> if <paramref name="obj" /> is an instance of <see cref="T:System.Half" /> and equals the value of this instance; otherwise, <see langword="false" /> .
Returns a value that indicates whether this instance is equal to the specified <paramref name="obj" /> .
public
int
GetHashCode​() Returns A 32-bit signed integer hash code.
Returns the hash code for this instance.
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="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" /> .