My Project
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
System.Half Struct Reference

Represents a half-precision floating point number. More...

Inheritance diagram for System.Half:

Public Member Functions

 Half (float value)
 Initializes a new instance of System.Half to the value of the specified single-precision floating-point number.
 
 Half (int value)
 Initializes a new instance of System.Half to the value of the specified 32-bit signed integer.
 
 Half (long value)
 Initializes a new instance of System.Half to the value of the specified 64-bit signed integer.
 
 Half (double value)
 Initializes a new instance of System.Half to the value of the specified double-precision floating-point number.
 
 Half (decimal value)
 Initializes a new instance of System.Half to the value of the specified decimal number.
 
 Half (uint value)
 Initializes a new instance of System.Half to the value of the specified 32-bit unsigned integer.
 
 Half (ulong value)
 Initializes a new instance of System.Half to the value of the specified 64-bit unsigned integer.
 
int CompareTo (Half other)
 Compares this instance to a specified System.Half object.
 
int CompareTo (object obj)
 Compares this instance to a specified System.Object.
 
bool Equals (Half other)
 Returns a value indicating whether this instance and a specified System.Half object represent the same value.
 
override bool Equals (object obj)
 Returns a value indicating whether this instance and a specified System.Object represent the same type and value.
 
override int GetHashCode ()
 Returns the hash code for this instance.
 
TypeCode GetTypeCode ()
 Returns the System.TypeCode for value type System.Half.
 
override string ToString ()
 Converts the numeric value of this instance to its equivalent string representation.
 
string ToString (IFormatProvider formatProvider)
 Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information.
 
string ToString (string format)
 Converts the numeric value of this instance to its equivalent string representation, using the specified format.
 
string ToString (string format, IFormatProvider formatProvider)
 Converts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information.
 
float IConvertible. ToSingle (IFormatProvider provider)
 
TypeCode IConvertible. GetTypeCode ()
 
bool IConvertible. ToBoolean (IFormatProvider provider)
 
byte IConvertible. ToByte (IFormatProvider provider)
 
char IConvertible. ToChar (IFormatProvider provider)
 
DateTime IConvertible. ToDateTime (IFormatProvider provider)
 
decimal IConvertible. ToDecimal (IFormatProvider provider)
 
double IConvertible. ToDouble (IFormatProvider provider)
 
short IConvertible. ToInt16 (IFormatProvider provider)
 
int IConvertible. ToInt32 (IFormatProvider provider)
 
long IConvertible. ToInt64 (IFormatProvider provider)
 
sbyte IConvertible. ToSByte (IFormatProvider provider)
 
string IConvertible. ToString (IFormatProvider provider)
 
object IConvertible. ToType (Type conversionType, IFormatProvider provider)
 
ushort IConvertible. ToUInt16 (IFormatProvider provider)
 
uint IConvertible. ToUInt32 (IFormatProvider provider)
 
ulong IConvertible. ToUInt64 (IFormatProvider provider)
 

Static Public Member Functions

static Half Negate (Half half)
 Returns the result of multiplying the specified System.Half value by negative one.
 
static Half Add (Half half1, Half half2)
 Adds two specified System.Half values.
 
static Half Subtract (Half half1, Half half2)
 Subtracts one specified System.Half value from another.
 
static Half Multiply (Half half1, Half half2)
 Multiplies two specified System.Half values.
 
static Half Divide (Half half1, Half half2)
 Divides two specified System.Half values.
 
static Half operator+ (Half half)
 Returns the value of the System.Half operand (the sign of the operand is unchanged).
 
static Half operator- (Half half)
 Negates the value of the specified System.Half operand.
 
static Half operator++ (Half half)
 Increments the System.Half operand by 1.
 
static Half operator-- (Half half)
 Decrements the System.Half operand by one.
 
static Half operator+ (Half half1, Half half2)
 Adds two specified System.Half values.
 
static Half operator- (Half half1, Half half2)
 Subtracts two specified System.Half values.
 
static Half operator* (Half half1, Half half2)
 Multiplies two specified System.Half values.
 
static Half operator/ (Half half1, Half half2)
 Divides two specified System.Half values.
 
static bool operator== (Half half1, Half half2)
 Returns a value indicating whether two instances of System.Half are equal.
 
static bool operator!= (Half half1, Half half2)
 Returns a value indicating whether two instances of System.Half are not equal.
 
static bool operator< (Half half1, Half half2)
 Returns a value indicating whether a specified System.Half is less than another specified System.Half.
 
static bool operator> (Half half1, Half half2)
 Returns a value indicating whether a specified System.Half is greater than another specified System.Half.
 
static bool operator<= (Half half1, Half half2)
 Returns a value indicating whether a specified System.Half is less than or equal to another specified System.Half.
 
static bool operator>= (Half half1, Half half2)
 Returns a value indicating whether a specified System.Half is greater than or equal to another specified System.Half.
 
static implicit operator Half (byte value)
 Converts an 8-bit unsigned integer to a System.Half.
 
static implicit operator Half (short value)
 Converts a 16-bit signed integer to a System.Half.
 
static implicit operator Half (char value)
 Converts a Unicode character to a System.Half.
 
static implicit operator Half (int value)
 Converts a 32-bit signed integer to a System.Half.
 
static implicit operator Half (long value)
 Converts a 64-bit signed integer to a System.Half.
 
static operator Half (float value)
 Converts a single-precision floating-point number to a System.Half.
 
static operator Half (double value)
 Converts a double-precision floating-point number to a System.Half.
 
static operator Half (decimal value)
 Converts a decimal number to a System.Half.
 
static operator byte (Half value)
 Converts a System.Half to an 8-bit unsigned integer.
 
static operator char (Half value)
 Converts a System.Half to a Unicode character.
 
static operator short (Half value)
 Converts a System.Half to a 16-bit signed integer.
 
static operator int (Half value)
 Converts a System.Half to a 32-bit signed integer.
 
static operator long (Half value)
 Converts a System.Half to a 64-bit signed integer.
 
static implicit operator float (Half value)
 Converts a System.Half to a single-precision floating-point number.
 
static implicit operator double (Half value)
 Converts a System.Half to a double-precision floating-point number.
 
static operator decimal (Half value)
 Converts a System.Half to a decimal number.
 
static implicit operator Half (sbyte value)
 Converts an 8-bit signed integer to a System.Half.
 
static implicit operator Half (ushort value)
 Converts a 16-bit unsigned integer to a System.Half.
 
static implicit operator Half (uint value)
 Converts a 32-bit unsigned integer to a System.Half.
 
static implicit operator Half (ulong value)
 Converts a 64-bit unsigned integer to a System.Half.
 
static operator sbyte (Half value)
 Converts a System.Half to an 8-bit signed integer.
 
static operator ushort (Half value)
 Converts a System.Half to a 16-bit unsigned integer.
 
static operator uint (Half value)
 Converts a System.Half to a 32-bit unsigned integer.
 
static operator ulong (Half value)
 Converts a System.Half to a 64-bit unsigned integer.
 
static byte[] GetBytes (Half value)
 Returns the specified half-precision floating point value as an array of bytes.
 
static ushort GetBits (Half value)
 Converts the value of a specified instance of System.Half to its equivalent binary representation.
 
static Half ToHalf (byte[] value, int startIndex)
 Returns a half-precision floating point number converted from two bytes at a specified position in a byte array.
 
static Half ToHalf (ushort bits)
 Returns a half-precision floating point number converted from its binary representation.
 
static int Sign (Half value)
 Returns a value indicating the sign of a half-precision floating-point number.
 
static Half Abs (Half value)
 Returns the absolute value of a half-precision floating-point number.
 
static Half Max (Half value1, Half value2)
 Returns the larger of two half-precision floating-point numbers.
 
static Half Min (Half value1, Half value2)
 Returns the smaller of two half-precision floating-point numbers.
 
static bool IsNaN (Half half)
 Returns a value indicating whether the specified number evaluates to not a number (System.Half.NaN).
 
static bool IsInfinity (Half half)
 Returns a value indicating whether the specified number evaluates to negative or positive infinity.
 
static bool IsNegativeInfinity (Half half)
 Returns a value indicating whether the specified number evaluates to negative infinity.
 
static bool IsPositiveInfinity (Half half)
 Returns a value indicating whether the specified number evaluates to positive infinity.
 
static Half Parse (string value)
 Converts the string representation of a number to its System.Half equivalent.
 
static Half Parse (string value, IFormatProvider provider)
 Converts the string representation of a number to its System.Half equivalent using the specified culture-specific format information.
 
static Half Parse (string value, NumberStyles style)
 Converts the string representation of a number in a specified style to its System.Half equivalent.
 
static Half Parse (string value, NumberStyles style, IFormatProvider provider)
 Converts the string representation of a number to its System.Half equivalent using the specified style and culture-specific format.
 
static bool TryParse (string value, out Half result)
 Converts the string representation of a number to its System.Half equivalent. A return value indicates whether the conversion succeeded or failed.
 
static bool TryParse (string value, NumberStyles style, IFormatProvider provider, out Half result)
 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.
 

Public Attributes

ushort internalValue
 Internal representation of the half-precision floating-point number.
 

Static Public Attributes

static readonly Half Epsilon = Half.ToHalf(0x0001)
 Represents the smallest positive System.Half value greater than zero. This field is constant.
 
static readonly Half MaxValue = Half.ToHalf(0x7bff)
 Represents the largest possible value of System.Half. This field is constant.
 
static readonly Half MinValue = Half.ToHalf(0xfbff)
 Represents the smallest possible value of System.Half. This field is constant.
 
static readonly Half NaN = Half.ToHalf(0xfe00)
 Represents not a number (NaN). This field is constant.
 
static readonly Half NegativeInfinity = Half.ToHalf(0xfc00)
 Represents negative infinity. This field is constant.
 
static readonly Half PositiveInfinity = Half.ToHalf(0x7c00)
 Represents positive infinity. This field is constant.
 

Detailed Description

Represents a half-precision floating point number.

Note: Half is not fast enough and precision is also very bad, so it should not be used for matemathical 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:

Constructor & Destructor Documentation

◆ Half() [1/7]

System.Half.Half ( float  value)
inline

Initializes a new instance of System.Half to the value of the specified single-precision floating-point number.

Parameters
valueThe value to represent as a System.Half.

◆ Half() [2/7]

System.Half.Half ( int  value)
inline

Initializes a new instance of System.Half to the value of the specified 32-bit signed integer.

Parameters
valueThe value to represent as a System.Half.

◆ Half() [3/7]

System.Half.Half ( long  value)
inline

Initializes a new instance of System.Half to the value of the specified 64-bit signed integer.

Parameters
valueThe value to represent as a System.Half.

◆ Half() [4/7]

System.Half.Half ( double  value)
inline

Initializes a new instance of System.Half to the value of the specified double-precision floating-point number.

Parameters
valueThe value to represent as a System.Half.

◆ Half() [5/7]

System.Half.Half ( decimal  value)
inline

Initializes a new instance of System.Half to the value of the specified decimal number.

Parameters
valueThe value to represent as a System.Half.

◆ Half() [6/7]

System.Half.Half ( uint  value)
inline

Initializes a new instance of System.Half to the value of the specified 32-bit unsigned integer.

Parameters
valueThe value to represent as a System.Half.

◆ Half() [7/7]

System.Half.Half ( ulong  value)
inline

Initializes a new instance of System.Half to the value of the specified 64-bit unsigned integer.

Parameters
valueThe value to represent as a System.Half.

Member Function Documentation

◆ Abs()

static Half System.Half.Abs ( Half  value)
inlinestatic

Returns the absolute value of a half-precision floating-point number.

Parameters
valueA number in the range System.Half.MinValue ≤ value ≤ System.Half.MaxValue.
Returns
A half-precision floating-point number, x, such that 0 ≤ x ≤System.Half.MaxValue.

◆ Add()

static Half System.Half.Add ( Half  half1,
Half  half2 
)
inlinestatic

Adds two specified System.Half values.

Parameters
half1A System.Half.
half2A System.Half.
Returns
A System.Half value that is the sum of half1 and half2.

◆ CompareTo() [1/2]

int System.Half.CompareTo ( Half  other)
inline

Compares this instance to a specified System.Half object.

Parameters
otherA System.Half object.
Returns
A signed number indicating the relative values of this instance and value. Return Value Meaning Less than zero This instance is less than value. Zero This instance is equal to value. Greater than zero This instance is greater than value.

◆ CompareTo() [2/2]

int System.Half.CompareTo ( object  obj)
inline

Compares this instance to a specified System.Object.

Parameters
objAn System.Object or null.
Returns
A signed number indicating the relative values of this instance and value. Return Value Meaning Less than zero This instance is less than value. Zero This instance is equal to value. Greater than zero This instance is greater than value. -or- value is null.
Exceptions
System.ArgumentExceptionvalue is not a System.Half

◆ Divide()

static Half System.Half.Divide ( Half  half1,
Half  half2 
)
inlinestatic

Divides two specified System.Half values.

Parameters
half1A System.Half (the dividend).
half2A System.Half (the divisor).
Returns
The System.Half that is the result of dividing half1 by half2.
Exceptions
System.DivideByZeroExceptionhalf2 is zero.

◆ Equals() [1/2]

bool System.Half.Equals ( Half  other)
inline

Returns a value indicating whether this instance and a specified System.Half object represent the same value.

Parameters
otherA System.Half object to compare to this instance.
Returns
true if value is equal to this instance; otherwise, false.

◆ Equals() [2/2]

override bool System.Half.Equals ( object  obj)
inline

Returns a value indicating whether this instance and a specified System.Object represent the same type and value.

Parameters
objAn System.Object.
Returns
true if value is a System.Half and equal to this instance; otherwise, false.

◆ GetBits()

static ushort System.Half.GetBits ( Half  value)
inlinestatic

Converts the value of a specified instance of System.Half to its equivalent binary representation.

Parameters
valueA System.Half value.
Returns
A 16-bit unsigned integer that contain the binary representation of value.


◆ GetBytes()

static byte[] System.Half.GetBytes ( Half  value)
inlinestatic

Returns the specified half-precision floating point value as an array of bytes.

Parameters
valueThe number to convert.
Returns
An array of bytes with length 2.

◆ GetHashCode()

override int System.Half.GetHashCode ( )
inline

Returns the hash code for this instance.

Returns
A 32-bit signed integer hash code.

◆ GetTypeCode()

TypeCode System.Half.GetTypeCode ( )
inline

Returns the System.TypeCode for value type System.Half.

Returns
The enumerated constant (TypeCode)255.

◆ IsInfinity()

static bool System.Half.IsInfinity ( Half  half)
inlinestatic

Returns a value indicating whether the specified number evaluates to negative or positive infinity.

Parameters
halfA half-precision floating-point number.
Returns
true if half evaluates to System.Half.PositiveInfinity or System.Half.NegativeInfinity; otherwise, false.

◆ IsNaN()

static bool System.Half.IsNaN ( Half  half)
inlinestatic

Returns a value indicating whether the specified number evaluates to not a number (System.Half.NaN).

Parameters
halfA half-precision floating-point number.
Returns
true if value evaluates to not a number (System.Half.NaN); otherwise, false.

◆ IsNegativeInfinity()

static bool System.Half.IsNegativeInfinity ( Half  half)
inlinestatic

Returns a value indicating whether the specified number evaluates to negative infinity.

Parameters
halfA half-precision floating-point number.
Returns
true if half evaluates to System.Half.NegativeInfinity; otherwise, false.

◆ IsPositiveInfinity()

static bool System.Half.IsPositiveInfinity ( Half  half)
inlinestatic

Returns a value indicating whether the specified number evaluates to positive infinity.

Parameters
halfA half-precision floating-point number.
Returns
true if half evaluates to System.Half.PositiveInfinity; otherwise, false.

◆ Max()

static Half System.Half.Max ( Half  value1,
Half  value2 
)
inlinestatic

Returns the larger of two half-precision floating-point numbers.

Parameters
value1The first of two half-precision floating-point numbers to compare.
value2The second of two half-precision floating-point numbers to compare.
Returns
Parameter value1 or value2, whichever is larger. If value1, or value2, or both val1 and value2 are equal to System.Half.NaN, System.Half.NaN is returned.

◆ Min()

static Half System.Half.Min ( Half  value1,
Half  value2 
)
inlinestatic

Returns the smaller of two half-precision floating-point numbers.

Parameters
value1The first of two half-precision floating-point numbers to compare.
value2The second of two half-precision floating-point numbers to compare.
Returns
Parameter value1 or value2, whichever is smaller. If value1, or value2, or both val1 and value2 are equal to System.Half.NaN, System.Half.NaN is returned.

◆ Multiply()

static Half System.Half.Multiply ( Half  half1,
Half  half2 
)
inlinestatic

Multiplies two specified System.Half values.

Parameters
half1A System.Half (the multiplicand).
half2A System.Half (the multiplier).
Returns
A System.Half that is the result of multiplying half1 and half2.

◆ Negate()

static Half System.Half.Negate ( Half  half)
inlinestatic

Returns the result of multiplying the specified System.Half value by negative one.

Parameters
halfA System.Half.
Returns
A System.Half with the value of half, but the opposite sign. -or- Zero, if half is zero.

◆ operator byte()

static System.Half.operator byte ( Half  value)
inlineexplicitstatic

Converts a System.Half to an 8-bit unsigned integer.

Parameters
valueA System.Half to convert.
Returns
An 8-bit unsigned integer that represents the converted System.Half.

◆ operator char()

static System.Half.operator char ( Half  value)
inlineexplicitstatic

Converts a System.Half to a Unicode character.

Parameters
valueA System.Half to convert.
Returns
A Unicode character that represents the converted System.Half.

◆ operator decimal()

static System.Half.operator decimal ( Half  value)
inlineexplicitstatic

Converts a System.Half to a decimal number.

Parameters
valueA System.Half to convert.
Returns
A decimal number that represents the converted System.Half.

◆ operator double()

static implicit System.Half.operator double ( Half  value)
inlinestatic

Converts a System.Half to a double-precision floating-point number.

Parameters
valueA System.Half to convert.
Returns
A double-precision floating-point number that represents the converted System.Half.

◆ operator float()

static implicit System.Half.operator float ( Half  value)
inlinestatic

Converts a System.Half to a single-precision floating-point number.

Parameters
valueA System.Half to convert.
Returns
A single-precision floating-point number that represents the converted System.Half.

◆ operator Half() [1/12]

static implicit System.Half.operator Half ( byte  value)
inlinestatic

Converts an 8-bit unsigned integer to a System.Half.

Parameters
valueAn 8-bit unsigned integer.
Returns
A System.Half that represents the converted 8-bit unsigned integer.

◆ operator Half() [2/12]

static implicit System.Half.operator Half ( char  value)
inlinestatic

Converts a Unicode character to a System.Half.

Parameters
valueA Unicode character.
Returns
A System.Half that represents the converted Unicode character.

◆ operator Half() [3/12]

static System.Half.operator Half ( decimal  value)
inlineexplicitstatic

Converts a decimal number to a System.Half.

Parameters
valuedecimal number
Returns
A System.Half that represents the converted decimal number.

◆ operator Half() [4/12]

static System.Half.operator Half ( double  value)
inlineexplicitstatic

Converts a double-precision floating-point number to a System.Half.

Parameters
valueA double-precision floating-point number.
Returns
A System.Half that represents the converted double-precision floating point number.

◆ operator Half() [5/12]

static System.Half.operator Half ( float  value)
inlineexplicitstatic

Converts a single-precision floating-point number to a System.Half.

Parameters
valueA single-precision floating-point number.
Returns
A System.Half that represents the converted single-precision floating point number.

◆ operator Half() [6/12]

static implicit System.Half.operator Half ( int  value)
inlinestatic

Converts a 32-bit signed integer to a System.Half.

Parameters
valueA 32-bit signed integer.
Returns
A System.Half that represents the converted 32-bit signed integer.

◆ operator Half() [7/12]

static implicit System.Half.operator Half ( long  value)
inlinestatic

Converts a 64-bit signed integer to a System.Half.

Parameters
valueA 64-bit signed integer.
Returns
A System.Half that represents the converted 64-bit signed integer.

◆ operator Half() [8/12]

static implicit System.Half.operator Half ( sbyte  value)
inlinestatic

Converts an 8-bit signed integer to a System.Half.

Parameters
valueAn 8-bit signed integer.
Returns
A System.Half that represents the converted 8-bit signed integer.

◆ operator Half() [9/12]

static implicit System.Half.operator Half ( short  value)
inlinestatic

Converts a 16-bit signed integer to a System.Half.

Parameters
valueA 16-bit signed integer.
Returns
A System.Half that represents the converted 16-bit signed integer.

◆ operator Half() [10/12]

static implicit System.Half.operator Half ( uint  value)
inlinestatic

Converts a 32-bit unsigned integer to a System.Half.

Parameters
valueA 32-bit unsigned integer.
Returns
A System.Half that represents the converted 32-bit unsigned integer.

◆ operator Half() [11/12]

static implicit System.Half.operator Half ( ulong  value)
inlinestatic

Converts a 64-bit unsigned integer to a System.Half.

Parameters
valueA 64-bit unsigned integer.
Returns
A System.Half that represents the converted 64-bit unsigned integer.

◆ operator Half() [12/12]

static implicit System.Half.operator Half ( ushort  value)
inlinestatic

Converts a 16-bit unsigned integer to a System.Half.

Parameters
valueA 16-bit unsigned integer.
Returns
A System.Half that represents the converted 16-bit unsigned integer.

◆ operator int()

static System.Half.operator int ( Half  value)
inlineexplicitstatic

Converts a System.Half to a 32-bit signed integer.

Parameters
valueA System.Half to convert.
Returns
A 32-bit signed integer that represents the converted System.Half.

◆ operator long()

static System.Half.operator long ( Half  value)
inlineexplicitstatic

Converts a System.Half to a 64-bit signed integer.

Parameters
valueA System.Half to convert.
Returns
A 64-bit signed integer that represents the converted System.Half.

◆ operator sbyte()

static System.Half.operator sbyte ( Half  value)
inlineexplicitstatic

Converts a System.Half to an 8-bit signed integer.

Parameters
valueA System.Half to convert.
Returns
An 8-bit signed integer that represents the converted System.Half.

◆ operator short()

static System.Half.operator short ( Half  value)
inlineexplicitstatic

Converts a System.Half to a 16-bit signed integer.

Parameters
valueA System.Half to convert.
Returns
A 16-bit signed integer that represents the converted System.Half.

◆ operator uint()

static System.Half.operator uint ( Half  value)
inlineexplicitstatic

Converts a System.Half to a 32-bit unsigned integer.

Parameters
valueA System.Half to convert.
Returns
A 32-bit unsigned integer that represents the converted System.Half.

◆ operator ulong()

static System.Half.operator ulong ( Half  value)
inlineexplicitstatic

Converts a System.Half to a 64-bit unsigned integer.

Parameters
valueA System.Half to convert.
Returns
A 64-bit unsigned integer that represents the converted System.Half.

◆ operator ushort()

static System.Half.operator ushort ( Half  value)
inlineexplicitstatic

Converts a System.Half to a 16-bit unsigned integer.

Parameters
valueA System.Half to convert.
Returns
A 16-bit unsigned integer that represents the converted System.Half.

◆ operator!=()

static bool System.Half.operator!= ( Half  half1,
Half  half2 
)
inlinestatic

Returns a value indicating whether two instances of System.Half are not equal.

Parameters
half1A System.Half.
half2A System.Half.
Returns
true if half1 and half2 are not equal; otherwise, false.

◆ operator*()

static Half System.Half.operator* ( Half  half1,
Half  half2 
)
inlinestatic

Multiplies two specified System.Half values.

Parameters
half1A System.Half.
half2A System.Half.
Returns
The System.Half result of multiplying half1 by half2.

◆ operator+() [1/2]

static Half System.Half.operator+ ( Half  half)
inlinestatic

Returns the value of the System.Half operand (the sign of the operand is unchanged).

Parameters
halfThe System.Half operand.
Returns
The value of the operand, half.

◆ operator+() [2/2]

static Half System.Half.operator+ ( Half  half1,
Half  half2 
)
inlinestatic

Adds two specified System.Half values.

Parameters
half1A System.Half.
half2A System.Half.
Returns
The System.Half result of adding half1 and half2.

◆ operator++()

static Half System.Half.operator++ ( Half  half)
inlinestatic

Increments the System.Half operand by 1.

Parameters
halfThe System.Half operand.
Returns
The value of half incremented by 1.

◆ operator-() [1/2]

static Half System.Half.operator- ( Half  half)
inlinestatic

Negates the value of the specified System.Half operand.

Parameters
halfThe System.Half operand.
Returns
The result of half multiplied by negative one (-1).

◆ operator-() [2/2]

static Half System.Half.operator- ( Half  half1,
Half  half2 
)
inlinestatic

Subtracts two specified System.Half values.

Parameters
half1A System.Half.
half2A System.Half.
Returns
The System.Half result of subtracting half1 and half2.


◆ operator--()

static Half System.Half.operator-- ( Half  half)
inlinestatic

Decrements the System.Half operand by one.

Parameters
halfThe System.Half operand.
Returns
The value of half decremented by 1.

◆ operator/()

static Half System.Half.operator/ ( Half  half1,
Half  half2 
)
inlinestatic

Divides two specified System.Half values.

Parameters
half1A System.Half (the dividend).
half2A System.Half (the divisor).
Returns
The System.Half result of half1 by half2.

◆ operator<()

static bool System.Half.operator< ( Half  half1,
Half  half2 
)
inlinestatic

Returns a value indicating whether a specified System.Half is less than another specified System.Half.

Parameters
half1A System.Half.
half2A System.Half.
Returns
true if half1 is less than half1; otherwise, false.

◆ operator<=()

static bool System.Half.operator<= ( Half  half1,
Half  half2 
)
inlinestatic

Returns a value indicating whether a specified System.Half is less than or equal to another specified System.Half.

Parameters
half1A System.Half.
half2A System.Half.
Returns
true if half1 is less than or equal to half2; otherwise, false.

◆ operator==()

static bool System.Half.operator== ( Half  half1,
Half  half2 
)
inlinestatic

Returns a value indicating whether two instances of System.Half are equal.

Parameters
half1A System.Half.
half2A System.Half.
Returns
true if half1 and half2 are equal; otherwise, false.

◆ operator>()

static bool System.Half.operator> ( Half  half1,
Half  half2 
)
inlinestatic

Returns a value indicating whether a specified System.Half is greater than another specified System.Half.

Parameters
half1A System.Half.
half2A System.Half.
Returns
true if half1 is greater than half2; otherwise, false.

◆ operator>=()

static bool System.Half.operator>= ( Half  half1,
Half  half2 
)
inlinestatic

Returns a value indicating whether a specified System.Half is greater than or equal to another specified System.Half.

Parameters
half1A System.Half.
half2A System.Half.
Returns
true if half1 is greater than or equal to half2; otherwise, false.

◆ Parse() [1/4]

static Half System.Half.Parse ( string  value)
inlinestatic

Converts the string representation of a number to its System.Half equivalent.

Parameters
valueThe string representation of the number to convert.
Returns
The System.Half number equivalent to the number contained in value.
Exceptions
System.ArgumentNullExceptionvalue is null.
System.FormatExceptionvalue is not in the correct format.
System.OverflowExceptionvalue represents a number less than System.Half.MinValue or greater than System.Half.MaxValue.

◆ Parse() [2/4]

static Half System.Half.Parse ( string  value,
IFormatProvider  provider 
)
inlinestatic

Converts the string representation of a number to its System.Half equivalent using the specified culture-specific format information.

Parameters
valueThe string representation of the number to convert.
providerAn System.IFormatProvider that supplies culture-specific parsing information about value.
Returns
The System.Half number equivalent to the number contained in s as specified by provider.
Exceptions
System.ArgumentNullExceptionvalue is null.
System.FormatExceptionvalue is not in the correct format.
System.OverflowExceptionvalue represents a number less than System.Half.MinValue or greater than System.Half.MaxValue.

◆ Parse() [3/4]

static Half System.Half.Parse ( string  value,
NumberStyles  style 
)
inlinestatic

Converts the string representation of a number in a specified style to its System.Half equivalent.

Parameters
valueThe string representation of the number to convert.
styleA bitwise combination of System.Globalization.NumberStyles values that indicates the style elements that can be present in value. A typical value to specify is System.Globalization.NumberStyles.Number.
Returns
The System.Half number equivalent to the number contained in s as specified by style.
Exceptions
System.ArgumentNullExceptionvalue is null.
System.ArgumentExceptionstyle is not a System.Globalization.NumberStyles value. -or- style is the System.Globalization.NumberStyles.AllowHexSpecifier value.
System.FormatExceptionvalue is not in the correct format.
System.OverflowExceptionvalue represents a number less than System.Half.MinValue or greater than System.Half.MaxValue.

◆ Parse() [4/4]

static Half System.Half.Parse ( string  value,
NumberStyles  style,
IFormatProvider  provider 
)
inlinestatic

Converts the string representation of a number to its System.Half equivalent using the specified style and culture-specific format.

Parameters
valueThe string representation of the number to convert.
styleA bitwise combination of System.Globalization.NumberStyles values that indicates the style elements that can be present in value. A typical value to specify is System.Globalization.NumberStyles.Number.
providerAn System.IFormatProvider object that supplies culture-specific information about the format of value.
Returns
The System.Half number equivalent to the number contained in s as specified by style and provider.
Exceptions
System.ArgumentNullExceptionvalue is null.
System.ArgumentExceptionstyle is not a System.Globalization.NumberStyles value. -or- style is the System.Globalization.NumberStyles.AllowHexSpecifier value.
System.FormatExceptionvalue is not in the correct format.
System.OverflowExceptionvalue represents a number less than System.Half.MinValue or greater than System.Half.MaxValue.

◆ Sign()

static int System.Half.Sign ( Half  value)
inlinestatic

Returns a value indicating the sign of a half-precision floating-point number.

Parameters
valueA signed number.
Returns
A number indicating the sign of value. Number Description -1 value is less than zero. 0 value is equal to zero. 1 value is greater than zero.
Exceptions
System.ArithmeticExceptionvalue is equal to System.Half.NaN.

◆ Subtract()

static Half System.Half.Subtract ( Half  half1,
Half  half2 
)
inlinestatic

Subtracts one specified System.Half value from another.

Parameters
half1A System.Half (the minuend).
half2A System.Half (the subtrahend).
Returns
The System.Half result of subtracting half2 from half1.

◆ ToHalf() [1/2]

static Half System.Half.ToHalf ( byte[]  value,
int  startIndex 
)
inlinestatic

Returns a half-precision floating point number converted from two bytes at a specified position in a byte array.

Parameters
valueAn array of bytes.
startIndexThe starting position within value.
Returns
A half-precision floating point number formed by two bytes beginning at startIndex.
Exceptions
System.ArgumentExceptionstartIndex is greater than or equal to the length of value minus 1, and is less than or equal to the length of value minus 1.
System.ArgumentNullExceptionvalue is null.
System.ArgumentOutOfRangeExceptionstartIndex is less than zero or greater than the length of value minus 1.

◆ ToHalf() [2/2]

static Half System.Half.ToHalf ( ushort  bits)
inlinestatic

Returns a half-precision floating point number converted from its binary representation.

Parameters
bitsBinary representation of System.Half value
Returns
A half-precision floating point number formed by its binary representation.

◆ ToString() [1/4]

override string System.Half.ToString ( )
inline

Converts the numeric value of this instance to its equivalent string representation.

Returns
A string that represents the value of this instance.

◆ ToString() [2/4]

string System.Half.ToString ( IFormatProvider  formatProvider)
inline

Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information.

Parameters
formatProviderAn System.IFormatProvider that supplies culture-specific formatting information.
Returns
The string representation of the value of this instance as specified by provider.

◆ ToString() [3/4]

string System.Half.ToString ( string  format)
inline

Converts the numeric value of this instance to its equivalent string representation, using the specified format.

Parameters
formatA numeric format string.
Returns
The string representation of the value of this instance as specified by format.

◆ ToString() [4/4]

string System.Half.ToString ( string  format,
IFormatProvider  formatProvider 
)
inline

Converts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information.

Parameters
formatA numeric format string.
formatProviderAn System.IFormatProvider that supplies culture-specific formatting information.
Returns
The string representation of the value of this instance as specified by format and provider.
Exceptions
System.FormatExceptionformat is invalid.

◆ TryParse() [1/2]

static bool System.Half.TryParse ( string  value,
NumberStyles  style,
IFormatProvider  provider,
out Half  result 
)
inlinestatic

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.

Parameters
valueThe string representation of the number to convert.
styleA bitwise combination of System.Globalization.NumberStyles values that indicates the permitted format of value. A typical value to specify is System.Globalization.NumberStyles.Number.
providerAn System.IFormatProvider object that supplies culture-specific parsing information about value.
resultWhen this method returns, contains the System.Half number that is equivalent to the numeric value contained in value, if the conversion succeeded, or is zero if the conversion failed. The conversion fails if the s parameter is null, is not in a format compliant with style, or represents a number less than System.Half.MinValue or greater than System.Half.MaxValue. This parameter is passed uninitialized.
Returns
true if s was converted successfully; otherwise, false.
Exceptions
System.ArgumentExceptionstyle is not a System.Globalization.NumberStyles value. -or- style is the System.Globalization.NumberStyles.AllowHexSpecifier value.

◆ TryParse() [2/2]

static bool System.Half.TryParse ( string  value,
out Half  result 
)
inlinestatic

Converts the string representation of a number to its System.Half equivalent. A return value indicates whether the conversion succeeded or failed.

Parameters
valueThe string representation of the number to convert.
resultWhen this method returns, contains the System.Half number that is equivalent to the numeric value contained in value, if the conversion succeeded, or is zero if the conversion failed. The conversion fails if the s parameter is null, is not a number in a valid format, or represents a number less than System.Half.MinValue or greater than System.Half.MaxValue. This parameter is passed uninitialized.
Returns
true if s was converted successfully; otherwise, false.

The documentation for this struct was generated from the following file: