Click or drag to resize

HalfType Structure

Represents a half-precision floating point number.

Namespace:  NeoAxis
Assembly:  NeoAxis.Core (in NeoAxis.Core.dll) Version: 2024.1.1.0 (2024.1.1.0)
Syntax
C#
[SerializableAttribute]
public struct HalfType : IComparable, IFormattable, 
	IConvertible, IComparable<HalfType>, IEquatable<HalfType>

The HalfType type exposes the following members.

Constructors
  NameDescription
Public methodHalfType(Decimal)
Initializes a new instance of System.Half to the value of the specified decimal number.
Public methodHalfType(Double)
Initializes a new instance of System.Half to the value of the specified double-precision floating-point number.
Public methodHalfType(Int32)
Initializes a new instance of System.Half to the value of the specified 32-bit signed integer.
Public methodHalfType(Int64)
Initializes a new instance of System.Half to the value of the specified 64-bit signed integer.
Public methodHalfType(Single)
Initializes a new instance of System.Half to the value of the specified single-precision floating-point number.
Public methodHalfType(UInt32)
Initializes a new instance of System.Half to the value of the specified 32-bit unsigned integer.
Public methodHalfType(UInt64)
Initializes a new instance of System.Half to the value of the specified 64-bit unsigned integer.
Top
Methods
  NameDescription
Public methodStatic memberAbs
Returns the absolute value of a half-precision floating-point number.
Public methodStatic memberAdd
Adds two specified System.Half values.
Public methodCompareTo(Object)
Compares this instance to a specified System.Object.
Public methodCompareTo(HalfType)
Compares this instance to a specified System.Half object.
Public methodStatic memberDivide
Divides two specified System.Half values.
Public methodEquals(Object)
Returns a value indicating whether this instance and a specified System.Object represent the same type and value.
(Overrides ValueTypeEquals(Object).)
Public methodEquals(HalfType)
Returns a value indicating whether this instance and a specified System.Half object represent the same value.
Public methodStatic memberGetBits
Converts the value of a specified instance of System.Half to its equivalent binary representation.
Public methodStatic memberGetBytes
Returns the specified half-precision floating point value as an array of bytes.
Public methodGetHashCode
Returns the hash code for this instance.
(Overrides ValueTypeGetHashCode.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetTypeCode
Returns the System.TypeCode for value type System.Half.
Public methodStatic memberIsInfinity
Returns a value indicating whether the specified number evaluates to negative or positive infinity.
Public methodStatic memberIsNaN
Returns a value indicating whether the specified number evaluates to not a number (System.Half.NaN).
Public methodStatic memberIsNegativeInfinity
Returns a value indicating whether the specified number evaluates to negative infinity.
Public methodStatic memberIsPositiveInfinity
Returns a value indicating whether the specified number evaluates to positive infinity.
Public methodStatic memberMax
Returns the larger of two half-precision floating-point numbers.
Public methodStatic memberMin
Returns the smaller of two half-precision floating-point numbers.
Public methodStatic memberMultiply
Multiplies two specified System.Half values.
Public methodStatic memberNegate
Returns the result of multiplying the specified System.Half value by negative one.
Public methodStatic memberParse(String)
Converts the string representation of a number to its System.Half equivalent.
Public methodStatic memberParse(String, NumberStyles)
Converts the string representation of a number in a specified style to its System.Half equivalent.
Public methodStatic memberParse(String, IFormatProvider)
Converts the string representation of a number to its System.Half equivalent using the specified culture-specific format information.
Public methodStatic memberParse(String, NumberStyles, IFormatProvider)
Converts the string representation of a number to its System.Half equivalent using the specified style and culture-specific format.
Public methodStatic memberSign
Returns a value indicating the sign of a half-precision floating-point number.
Public methodStatic memberSubtract
Subtracts one specified System.Half value from another.
Public methodStatic memberToHalf(UInt16)
Returns a half-precision floating point number converted from its binary representation.
Public methodStatic memberToHalf(Byte, Int32)
Returns a half-precision floating point number converted from two bytes at a specified position in a byte array.
Public methodToString
Converts the numeric value of this instance to its equivalent string representation.
(Overrides ValueTypeToString.)
Public methodToString(IFormatProvider)
Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information.
Public methodToString(String)
Converts the numeric value of this instance to its equivalent string representation, using the specified format.
Public methodToString(String, IFormatProvider)
Converts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information.
Public methodStatic memberTryParse(String, HalfType)
Converts the string representation of a number to its System.Half equivalent. A return value indicates whether the conversion succeeded or failed.
Public methodStatic memberTryParse(String, NumberStyles, IFormatProvider, HalfType)
Converts the string representation of a number to its System.Half equivalent using the specified style and culture-specific format. A return value indicates whether the conversion succeeded or failed.
Top
Operators
  NameDescription
Public operatorStatic memberAddition
Adds two specified System.Half values.
Public operatorStatic memberDecrement
Decrements the System.Half operand by one.
Public operatorStatic memberDivision
Divides two specified System.Half values.
Public operatorStatic memberEquality
Returns a value indicating whether two instances of System.Half are equal.
Public operatorStatic member(Decimal to HalfType)
Converts a decimal number to a System.Half.
Public operatorStatic member(Double to HalfType)
Converts a double-precision floating-point number to a System.Half.
Public operatorStatic member(Single to HalfType)
Converts a single-precision floating-point number to a System.Half.
Public operatorStatic member(HalfType to Byte)
Converts a System.Half to an 8-bit unsigned integer.
Public operatorStatic member(HalfType to Char)
Converts a System.Half to a Unicode character.
Public operatorStatic member(HalfType to Int16)
Converts a System.Half to a 16-bit signed integer.
Public operatorStatic member(HalfType to Int32)
Converts a System.Half to a 32-bit signed integer.
Public operatorStatic member(HalfType to Int64)
Converts a System.Half to a 64-bit signed integer.
Public operatorStatic member(HalfType to Decimal)
Converts a System.Half to a decimal number.
Public operatorStatic member(HalfType to SByte)
Converts a System.Half to an 8-bit signed integer.
Public operatorStatic member(HalfType to UInt16)
Converts a System.Half to a 16-bit unsigned integer.
Public operatorStatic member(HalfType to UInt32)
Converts a System.Half to a 32-bit unsigned integer.
Public operatorStatic member(HalfType to UInt64)
Converts a System.Half to a 64-bit unsigned integer.
Public operatorStatic memberGreaterThan
Returns a value indicating whether a specified System.Half is greater than another specified System.Half.
Public operatorStatic memberGreaterThanOrEqual
Returns a value indicating whether a specified System.Half is greater than or equal to another specified System.Half.
Public operatorStatic member(Byte to HalfType)
Converts an 8-bit unsigned integer to a System.Half.
Public operatorStatic member(Char to HalfType)
Converts a Unicode character to a System.Half.
Public operatorStatic member(Int16 to HalfType)
Converts a 16-bit signed integer to a System.Half.
Public operatorStatic member(Int32 to HalfType)
Converts a 32-bit signed integer to a System.Half.
Public operatorStatic member(Int64 to HalfType)
Converts a 64-bit signed integer to a System.Half.
Public operatorStatic member(SByte to HalfType)
Converts an 8-bit signed integer to a System.Half.
Public operatorStatic member(UInt16 to HalfType)
Converts a 16-bit unsigned integer to a System.Half.
Public operatorStatic member(UInt32 to HalfType)
Converts a 32-bit unsigned integer to a System.Half.
Public operatorStatic member(UInt64 to HalfType)
Converts a 64-bit unsigned integer to a System.Half.
Public operatorStatic member(HalfType to Single)
Converts a System.Half to a single-precision floating-point number.
Public operatorStatic member(HalfType to Double)
Converts a System.Half to a double-precision floating-point number.
Public operatorStatic memberIncrement
Increments the System.Half operand by 1.
Public operatorStatic memberInequality
Returns a value indicating whether two instances of System.Half are not equal.
Public operatorStatic memberLessThan
Returns a value indicating whether a specified System.Half is less than another specified System.Half.
Public operatorStatic memberLessThanOrEqual
Returns a value indicating whether a specified System.Half is less than or equal to another specified System.Half.
Public operatorStatic memberMultiply
Multiplies two specified System.Half values.
Public operatorStatic memberSubtraction
Subtracts two specified System.Half values.
Public operatorStatic memberUnaryNegation
Negates the value of the specified System.Half operand.
Public operatorStatic memberUnaryPlus
Returns the value of the System.Half operand (the sign of the operand is unchanged).
Top
Fields
  NameDescription
Public fieldStatic memberEpsilon
Represents the smallest positive System.Half value greater than zero. This field is constant.
Public fieldStatic memberMaxValue
Represents the largest possible value of System.Half. This field is constant.
Public fieldStatic memberMinValue
Represents the smallest possible value of System.Half. This field is constant.
Public fieldStatic memberNaN
Represents not a number (NaN). This field is constant.
Public fieldStatic memberNegativeInfinity
Represents negative infinity. This field is constant.
Public fieldStatic memberOne
Public fieldStatic memberPositiveInfinity
Represents positive infinity. This field is constant.
Public fieldStatic memberZero
Top
Extension Methods
Remarks
Note: Half is not fast enought and precision is also very bad, so is should not be used for mathematical computation (use Single instead). The main advantage of Half type is lower memory cost: two bytes per number. Half is typically used in graphical applications. Note: All functions, where is used conversion half->float/float->half, are approx. ten times slower than float->double/double->float, i.e. ~3ns on 2GHz CPU. References: - Code retrieved from http://sourceforge.net/p/csharp-half/code/HEAD/tree/ on 2015-12-04 - Fast Half Float Conversions, Jeroen van der Zijp, link: http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf - IEEE 754 revision, link: http://grouper.ieee.org/groups/754/
See Also