Struct half
Syntax
public struct half : IEquatable<half>, IFormattable
Constructors
half(Double)
Constructs a half value from a double value.
Declaration
Parameters
Type |
Name |
Description |
System.Double |
v |
|
half(Single)
Constructs a half value from a float value.
Declaration
Parameters
Type |
Name |
Description |
System.Single |
v |
|
half(half)
Constructs a half value from a half value.
Declaration
Parameters
Type |
Name |
Description |
half |
x |
|
Fields
value
Declaration
Field Value
Type |
Description |
System.UInt16 |
|
zero
Declaration
public static readonly half zero
Field Value
Properties
MaxValue
Declaration
public static float MaxValue { get; }
Property Value
Type |
Description |
System.Single |
|
MinValue
Declaration
public static float MinValue { get; }
Property Value
Type |
Description |
System.Single |
|
Methods
Equals(Object)
Returns true if the half is equal to a given half, false otherwise.
Declaration
public override bool Equals(object o)
Parameters
Type |
Name |
Description |
System.Object |
o |
|
Returns
Type |
Description |
System.Boolean |
|
Overrides
System.ValueType.Equals(System.Object)
Equals(half)
Returns true if the half is equal to a given half, false otherwise.
Declaration
public bool Equals(half rhs)
Parameters
Type |
Name |
Description |
half |
rhs |
|
Returns
Type |
Description |
System.Boolean |
|
GetHashCode()
Returns a hash code for the half.
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
Overrides
System.ValueType.GetHashCode()
ToString()
Returns a string representation of the half.
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
Overrides
System.ValueType.ToString()
Returns a string representation of the half using a specified format and culture-specific format information.
Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
Type |
Name |
Description |
System.String |
format |
|
System.IFormatProvider |
formatProvider |
|
Returns
Type |
Description |
System.String |
|
Operators
Equality(half, half)
Returns whether two half values are equal.
Declaration
public static bool operator ==(half lhs, half rhs)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Explicit(Double to half)
Explicitly converts a double value to a half value.
Declaration
public static explicit operator half(double v)
Parameters
Type |
Name |
Description |
System.Double |
v |
|
Returns
Explicit(Single to half)
Explicitly converts a float value to a half value.
Declaration
public static explicit operator half(float v)
Parameters
Type |
Name |
Description |
System.Single |
v |
|
Returns
Implicit(half to Double)
Implicitly converts a half value to a double value.
Declaration
public static implicit operator double (half d)
Parameters
Type |
Name |
Description |
half |
d |
|
Returns
Type |
Description |
System.Double |
|
Implicit(half to Single)
Implicitly converts a half value to a float value.
Declaration
public static implicit operator float (half d)
Parameters
Type |
Name |
Description |
half |
d |
|
Returns
Type |
Description |
System.Single |
|
Inequality(half, half)
Returns whether two half values are different.
Declaration
public static bool operator !=(half lhs, half rhs)
Parameters
Returns
Type |
Description |
System.Boolean |
|