Half Half Struct

Definition

The name Half is derived from half-precision floating-point number. It occupies only 16 Bits, which are split into 1 Sign bit, 5 Exponent bits and 10 Mantissa bits.

[System.Serializable]
public struct Half : IComparable<OpenTK.Half>, IEquatable<OpenTK.Half>, IFormattable, System.Runtime.Serialization.ISerializable
type Half = struct
    interface ISerializable
    interface IFormattable
Inheritance
Attributes
Implements

Remarks

Quote from ARB_half_float_pixel specification:

Any representable 16-bit floating-point value is legal as input to a GL command that accepts 16-bit floating-point data. The

result of providing a value that is not a floating-point number (such as infinity or NaN) to such a command is unspecified,

but must not lead to GL interruption or termination. Providing a denormalized number or negative zero to GL must yield

predictable results.

Constructors

Half(Double) Half(Double)

The new Half instance will convert the parameter into 16-Bit Half precision floating point.

Half(Single) Half(Single)

The new Half instance will convert the parameter into 16-Bit Half precision floating point.

Half(Double, Boolean) Half(Double, Boolean)

The new Half instance will convert the parameter into 16-Bit Half precision floating point.

Half(SerializationInfo, StreamingContext) Half(SerializationInfo, StreamingContext)

Constructor used by ISerializable to deserialize the object.

Half(Single, Boolean) Half(Single, Boolean)

The new Half instance will convert the parameter into 16-Bit Half precision floating point.

Fields

Epsilon Epsilon

Smallest positive e for which half (1.0 + e) != half (1.0)

MaxValue MaxValue

Largest positive half

MinNormalizedValue MinNormalizedValue

Smallest positive normalized half

MinValue MinValue

Smallest positive half

SizeInBytes SizeInBytes

The size in bytes for an instance of the Half struct.

Properties

IsNaN IsNaN

Returns true if the Half represents Not A Number (NaN)

IsNegativeInfinity IsNegativeInfinity

Returns true if the Half represents negative infinity.

IsPositiveInfinity IsPositiveInfinity

Returns true if the Half represents positive infinity.

IsZero IsZero

Returns true if the Half is zero.

Methods

CompareTo(Half) CompareTo(Half)

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.

Equals(Half) Equals(Half)

Returns a value indicating whether this instance is equal to a specified OpenTK.Half value.

FromBinaryStream(BinaryReader) FromBinaryStream(BinaryReader)

Updates the Half by reading from a Stream.

FromBytes(Byte[], Int32) FromBytes(Byte[], Int32)
GetBytes(Half) GetBytes(Half)

Returns the Half as an array of bytes.

GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext)

Used by ISerialize to serialize the object.

Parse(String) Parse(String)
Parse(String, NumberStyles, IFormatProvider) Parse(String, NumberStyles, IFormatProvider)
ToBinaryStream(BinaryWriter) ToBinaryStream(BinaryWriter)

Writes the Half into a Stream.

ToSingle() ToSingle()

Converts the 16-Bit half to 32-Bit floating point.

ToString() ToString()

Converts this Half into a human-legible string representation.

ToString(String, IFormatProvider) ToString(String, IFormatProvider)

Converts this Half into a human-legible string representation.

TryParse(String, Half) TryParse(String, Half)

Converts the string representation of a number to a Half precision floating point equivalent. Returns success.

TryParse(String, NumberStyles, IFormatProvider, Half) TryParse(String, NumberStyles, IFormatProvider, Half)

Converts the string representation of a number to a Half precision floating point equivalent. Returns success.

Operators

Explicit(Double to Half) Explicit(Double to Half)
Explicit(Single to Half) Explicit(Single to Half)
Implicit(Half to Double) Implicit(Half to Double)

Converts a OpenTK.Half to a System.Double.

Implicit(Half to Single) Implicit(Half to Single)

Converts a OpenTK.Half to a System.Single.

Applies to