Struct Half
- Namespace
- HelixToolkit.Maths
- Assembly
- HelixToolkit.Maths.dll
A half precision (16 bit) floating point value.
public struct Half
- Inherited Members
- Extension Methods
Constructors
Half(float)
Initializes a new instance of the SharpDX.Half structure.
public Half(float value)
Parameters
valuefloatThe floating point value that should be stored in 16 bit format.
Half(ushort)
Initializes a new instance of the SharpDX.Half structure.
public Half(ushort rawvalue)
Parameters
rawvalueushortThe floating point value that should be stored in 16 bit format.
Fields
AdditionRounding
Additional rounding.
public const int AdditionRounding = 1
Field Value
Epsilon
Smallest such that 1.0 + epsilon != 1.0
public static readonly float Epsilon
Field Value
ExponentRadix
Exponent radix.
public const int ExponentRadix = 2
Field Value
MantissaBits
Number of bits in the mantissa.
public const int MantissaBits = 11
Field Value
MaxValue
Maximum value of the number.
public static readonly float MaxValue
Field Value
MaximumBinaryExponent
Maximum binary exponent.
public const int MaximumBinaryExponent = 15
Field Value
MaximumDecimalExponent
Maximum decimal exponent.
public const int MaximumDecimalExponent = 4
Field Value
MinValue
Minimum value of the number.
public static readonly float MinValue
Field Value
MinimumBinaryExponent
Minimum binary exponent.
public const int MinimumBinaryExponent = -14
Field Value
MinimumDecimalExponent
Minimum decimal exponent.
public const int MinimumDecimalExponent = -4
Field Value
PrecisionDigits
Number of decimal digits of precision.
public const int PrecisionDigits = 3
Field Value
Properties
RawValue
Gets or sets the raw 16 bit value used to back this half-float.
public ushort RawValue { readonly get; set; }
Property Value
Methods
ConvertToFloat(Half[])
Converts an array of half precision values into full precision values.
public static float[] ConvertToFloat(Half[] values)
Parameters
valuesHalf[]The values to be converted.
Returns
- float[]
An array of converted values.
ConvertToHalf(float[])
Converts an array of full precision values into half precision values.
public static Half[] ConvertToHalf(float[] values)
Parameters
valuesfloat[]The values to be converted.
Returns
- Half[]
An array of converted values.
Equals(Half)
Returns a value that indicates whether the current instance is equal to the specified object.
public readonly bool Equals(Half other)
Parameters
otherHalfObject to make the comparison with.
Returns
- bool
trueif the current instance is equal to the specified object;falseotherwise.
Equals(ref Half, ref Half)
Determines whether the specified object instances are considered equal.
public static bool Equals(ref Half value1, ref Half value2)
Parameters
Returns
- bool
trueifvalue1is the same instance asvalue2or if both arenullreferences or ifvalue1.Equals(value2)returnstrue; otherwise,false.
Equals(object?)
Returns a value that indicates whether the current instance is equal to a specified object.
public override readonly bool Equals(object? obj)
Parameters
objobjectObject to make the comparison with.
Returns
- bool
trueif the current instance is equal to the specified object;falseotherwise.
GetHashCode()
Returns the hash code for this instance.
public override readonly int GetHashCode()
Returns
- int
A 32-bit signed integer hash code.
ToString()
Converts the value of the object to its equivalent string representation.
public override readonly string ToString()
Returns
- string
The string representation of the value of this instance.
Operators
operator ==(Half, Half)
Tests for equality between two objects.
public static bool operator ==(Half left, Half right)
Parameters
Returns
- bool
trueiflefthas the same value asright; otherwise,false.
implicit operator float(Half)
Performs an implicit conversion from SharpDX.Half to float.
public static implicit operator float(Half value)
Parameters
valueHalfThe value to be converted.
Returns
- float
The converted value.
implicit operator Half(float)
Performs an explicit conversion from float to SharpDX.Half.
public static implicit operator Half(float value)
Parameters
valuefloatThe value to be converted.
Returns
- Half
The converted value.
operator !=(Half, Half)
Tests for inequality between two objects.
public static bool operator !=(Half left, Half right)
Parameters
Returns
- bool
trueiflefthas a different value thanright; otherwise,false.