Half Struct

Definition

Represents a half-precision floating-point number.

public value class Half : IComparable, IComparable<Half>, IEquatable<Half>, IFormattable
public value class Half : IComparable, IComparable<Half>, IEquatable<Half>, ISpanFormattable
public value class Half : IComparable<Half>, IEquatable<Half>, IParsable<Half>, ISpanParsable<Half>, System::Numerics::IAdditionOperators<Half, Half, Half>, System::Numerics::IAdditiveIdentity<Half, Half>, System::Numerics::IBinaryFloatingPointIeee754<Half>, System::Numerics::IBinaryNumber<Half>, System::Numerics::IBitwiseOperators<Half, Half, Half>, System::Numerics::IComparisonOperators<Half, Half>, System::Numerics::IDecrementOperators<Half>, System::Numerics::IDivisionOperators<Half, Half, Half>, System::Numerics::IEqualityOperators<Half, Half>, System::Numerics::IExponentialFunctions<Half>, System::Numerics::IFloatingPoint<Half>, System::Numerics::IFloatingPointIeee754<Half>, System::Numerics::IHyperbolicFunctions<Half>, System::Numerics::IIncrementOperators<Half>, System::Numerics::ILogarithmicFunctions<Half>, System::Numerics::IMinMaxValue<Half>, System::Numerics::IModulusOperators<Half, Half, Half>, System::Numerics::IMultiplicativeIdentity<Half, Half>, System::Numerics::IMultiplyOperators<Half, Half, Half>, System::Numerics::INumber<Half>, System::Numerics::INumberBase<Half>, System::Numerics::IPowerFunctions<Half>, System::Numerics::IRootFunctions<Half>, System::Numerics::ISignedNumber<Half>, System::Numerics::ISubtractionOperators<Half, Half, Half>, System::Numerics::ITrigonometricFunctions<Half>, System::Numerics::IUnaryNegationOperators<Half, Half>, System::Numerics::IUnaryPlusOperators<Half, Half>
public readonly struct Half : IComparable, IComparable<Half>, IEquatable<Half>, IFormattable
public readonly struct Half : IComparable, IComparable<Half>, IEquatable<Half>, ISpanFormattable
public readonly struct Half : IComparable<Half>, IEquatable<Half>, IParsable<Half>, ISpanParsable<Half>, System.Numerics.IAdditionOperators<Half,Half,Half>, System.Numerics.IAdditiveIdentity<Half,Half>, System.Numerics.IBinaryFloatingPointIeee754<Half>, System.Numerics.IBinaryNumber<Half>, System.Numerics.IBitwiseOperators<Half,Half,Half>, System.Numerics.IComparisonOperators<Half,Half>, System.Numerics.IDecrementOperators<Half>, System.Numerics.IDivisionOperators<Half,Half,Half>, System.Numerics.IEqualityOperators<Half,Half>, System.Numerics.IExponentialFunctions<Half>, System.Numerics.IFloatingPoint<Half>, System.Numerics.IFloatingPointIeee754<Half>, System.Numerics.IHyperbolicFunctions<Half>, System.Numerics.IIncrementOperators<Half>, System.Numerics.ILogarithmicFunctions<Half>, System.Numerics.IMinMaxValue<Half>, System.Numerics.IModulusOperators<Half,Half,Half>, System.Numerics.IMultiplicativeIdentity<Half,Half>, System.Numerics.IMultiplyOperators<Half,Half,Half>, System.Numerics.INumber<Half>, System.Numerics.INumberBase<Half>, System.Numerics.IPowerFunctions<Half>, System.Numerics.IRootFunctions<Half>, System.Numerics.ISignedNumber<Half>, System.Numerics.ISubtractionOperators<Half,Half,Half>, System.Numerics.ITrigonometricFunctions<Half>, System.Numerics.IUnaryNegationOperators<Half,Half>, System.Numerics.IUnaryPlusOperators<Half,Half>
type Half = struct
    interface IFormattable
type Half = struct
    interface ISpanFormattable
    interface IFormattable
type Half = struct
    interface IFormattable
    interface IParsable<Half>
    interface ISpanFormattable
    interface ISpanParsable<Half>
    interface IAdditionOperators<Half, Half, Half>
    interface IAdditiveIdentity<Half, Half>
    interface IBinaryFloatingPointIeee754<Half>
    interface IBinaryNumber<Half>
    interface IBitwiseOperators<Half, Half, Half>
    interface IComparisonOperators<Half, Half>
    interface IEqualityOperators<Half, Half>
    interface IDecrementOperators<Half>
    interface IDivisionOperators<Half, Half, Half>
    interface IIncrementOperators<Half>
    interface IModulusOperators<Half, Half, Half>
    interface IMultiplicativeIdentity<Half, Half>
    interface IMultiplyOperators<Half, Half, Half>
    interface INumber<Half>
    interface INumberBase<Half>
    interface ISubtractionOperators<Half, Half, Half>
    interface IUnaryNegationOperators<Half, Half>
    interface IUnaryPlusOperators<Half, Half>
    interface IExponentialFunctions<Half>
    interface IFloatingPoint<Half>
    interface ISignedNumber<Half>
    interface IFloatingPointIeee754<Half>
    interface IHyperbolicFunctions<Half>
    interface ILogarithmicFunctions<Half>
    interface IPowerFunctions<Half>
    interface IRootFunctions<Half>
    interface ITrigonometricFunctions<Half>
    interface IMinMaxValue<Half>
Public Structure Half
Implements IComparable, IComparable(Of Half), IEquatable(Of Half), IFormattable
Public Structure Half
Implements IComparable, IComparable(Of Half), IEquatable(Of Half), ISpanFormattable
Public Structure Half
Implements IAdditionOperators(Of Half, Half, Half), IAdditiveIdentity(Of Half, Half), IBinaryFloatingPointIeee754(Of Half), IBinaryNumber(Of Half), IBitwiseOperators(Of Half, Half, Half), IComparable(Of Half), IComparisonOperators(Of Half, Half), IDecrementOperators(Of Half), IDivisionOperators(Of Half, Half, Half), IEqualityOperators(Of Half, Half), IEquatable(Of Half), IExponentialFunctions(Of Half), IFloatingPoint(Of Half), IFloatingPointIeee754(Of Half), IHyperbolicFunctions(Of Half), IIncrementOperators(Of Half), ILogarithmicFunctions(Of Half), IMinMaxValue(Of Half), IModulusOperators(Of Half, Half, Half), IMultiplicativeIdentity(Of Half, Half), IMultiplyOperators(Of Half, Half, Half), INumber(Of Half), INumberBase(Of Half), IParsable(Of Half), IPowerFunctions(Of Half), IRootFunctions(Of Half), ISignedNumber(Of Half), ISpanParsable(Of Half), ISubtractionOperators(Of Half, Half, Half), ITrigonometricFunctions(Of Half), IUnaryNegationOperators(Of Half, Half), IUnaryPlusOperators(Of Half, Half)
Inheritance
Implements
IComparable IComparable<Half> IEquatable<Half> IFormattable ISpanFormattable IComparable<TOther> IComparable<TSelf> IEquatable<TOther> IEquatable<TSelf> IParsable<Half> IParsable<TSelf> ISpanParsable<Half> ISpanParsable<TSelf> IAdditionOperators<Half,Half,Half> IAdditionOperators<TSelf,TSelf,TSelf> IAdditiveIdentity<Half,Half> IAdditiveIdentity<TSelf,TSelf> IBinaryFloatingPointIeee754<Half> IBinaryNumber<Half> IBinaryNumber<TSelf> IBitwiseOperators<Half,Half,Half> IBitwiseOperators<TSelf,TSelf,TSelf> IComparisonOperators<Half,Half> IComparisonOperators<TSelf,TSelf> IDecrementOperators<Half> IDecrementOperators<TSelf> IDivisionOperators<Half,Half,Half> IDivisionOperators<TSelf,TSelf,TSelf> IEqualityOperators<Half,Half> IEqualityOperators<TSelf,TOther> IEqualityOperators<TSelf,TSelf> IExponentialFunctions<Half> IExponentialFunctions<TSelf> IFloatingPoint<Half> IFloatingPoint<TSelf> IFloatingPointIeee754<Half> IFloatingPointIeee754<TSelf> IHyperbolicFunctions<Half> IHyperbolicFunctions<TSelf> IIncrementOperators<Half> IIncrementOperators<TSelf> ILogarithmicFunctions<Half> ILogarithmicFunctions<TSelf> IMinMaxValue<Half> IModulusOperators<Half,Half,Half> IModulusOperators<TSelf,TSelf,TSelf> IMultiplicativeIdentity<Half,Half> IMultiplicativeIdentity<TSelf,TSelf> IMultiplyOperators<Half,Half,Half> IMultiplyOperators<TSelf,TSelf,TSelf> INumber<Half> INumber<TSelf> INumberBase<Half> INumberBase<TSelf> IPowerFunctions<Half> IPowerFunctions<TSelf> IRootFunctions<Half> IRootFunctions<TSelf> ISignedNumber<Half> ISignedNumber<TSelf> ISubtractionOperators<Half,Half,Half> ISubtractionOperators<TSelf,TSelf,TSelf> ITrigonometricFunctions<Half> ITrigonometricFunctions<TSelf> IUnaryNegationOperators<Half,Half> IUnaryNegationOperators<TSelf,TSelf> IUnaryPlusOperators<Half,Half> IUnaryPlusOperators<TSelf,TSelf>

Remarks

The Half value type represents a half-precision 16-bit number with values ranging from negative 65,504 to positive 65,504, as well as positive or negative zero, PositiveInfinity, NegativeInfinity, and not a number (NaN).

This is an IEEE 754-compliant float16 type.

Properties

E

Gets the mathematical constant e.

Epsilon

Represents the smallest positive Half value that is greater than zero.

MaxValue

Represents the largest possible value of Half.

MinValue

Represents the smallest possible value of Half.

MultiplicativeIdentity

Gets the multiplicative identity of the current type.

NaN

Represents not a number.

NegativeInfinity

Represents negative infinity.

NegativeOne

Gets the value -1 for the type.

NegativeZero

Gets a value that represents negative zero.

One

Gets the value 1 for the type.

Pi

Gets the mathematical constant pi.

PositiveInfinity

Represents positive infinity.

Tau

Gets the mathematical constant tau.

Zero

Gets the value 0 for the type.

Methods

Abs(Half)

Computes the absolute of a value.

Acos(Half)

Computes the arc-cosine of a value.

Acosh(Half)

Computes the hyperbolic arc-cosine of a value.

AcosPi(Half)

Computes the arc-cosine of a value and divides the result by pi.

Asin(Half)

Computes the arc-sine of a value.

Asinh(Half)

Computes the hyperbolic arc-sine of a value.

AsinPi(Half)

Computes the arc-sine of a value and divides the result by pi.

Atan(Half)

Computes the arc-tangent of a value.

Atan2(Half, Half)

Computes the arc-tangent of the quotient of two values.

Atan2Pi(Half, Half)

Computes the arc-tangent for the quotient of two values and divides the result by pi.

Atanh(Half)

Computes the hyperbolic arc-tangent of a value.

AtanPi(Half)

Computes the arc-tangent of a value and divides the result by pi.

BitDecrement(Half)

Decrements a value to the smallest value that compares less than a given value.

BitIncrement(Half)

Increments a value to the smallest value that compares greater than a given value.

Cbrt(Half)

Computes the cube-root of a value.

Ceiling(Half)

Computes the ceiling of a value.

Clamp(Half, Half, Half)

Clamps a value to an inclusive minimum and maximum value.

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.

CompareTo(Object)

Compares this instance to a specified object 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 object.

CopySign(Half, Half)

Copies the sign of a value to the sign of another value.

Cos(Half)

Computes the cosine of a value.

Cosh(Half)

Computes the hyperbolic cosine of a value.

CosPi(Half)

Computes the cosine of a value that has been multipled by pi.

Equals(Half)

Compares this instance for equality with other.

Equals(Object)

Returns a value that indicates whether this instance is equal to the specified obj.

Exp(Half)

Computes E raised to a given power.

Exp10(Half)

Computes 10 raised to a given power.

Exp10M1(Half)

Computes 10 raised to a given power and subtracts one.

Exp2(Half)

Computes 2 raised to a given power.

Exp2M1(Half)

Computes 2 raised to a given power and subtracts one.

ExpM1(Half)

Computes E raised to a given power and subtracts one.

Floor(Half)

Computes the floor of a value.

FusedMultiplyAdd(Half, Half, Half)

Computes the fused multiply-add of three values.

GetHashCode()

Returns the hash code for this instance.

Hypot(Half, Half)

Computes the hypotenuse given two values representing the lengths of the shorter sides in a right-angled triangle.

Ieee754Remainder(Half, Half)

Computes the remainder of two values as specified by IEEE 754.

ILogB(Half)

Computes the integer logarithm of a value.

IsEvenInteger(Half)

Determines if a value represents an even integral number.

IsFinite(Half)

Determines whether the specified value is finite (zero, subnormal, or normal).

IsInfinity(Half)

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

IsInteger(Half)

Determines if a value represents an integral value.

IsNaN(Half)

Determines whether the specified value is not a number.

IsNegative(Half)

Determines whether the specified value is negative.

IsNegativeInfinity(Half)

Determines whether the specified value is negative infinity.

IsNormal(Half)

Determines whether the specified value is normal.

IsOddInteger(Half)

Determines if a value represents an odd integral number.

IsPositive(Half)

Determines if a value is positive.

IsPositiveInfinity(Half)

Determines whether the specified value is positive infinity.

IsPow2(Half)

Determines if a value is a power of two.

IsRealNumber(Half)

Determines if a value represents a real number.

IsSubnormal(Half)

Determines whether the specified value is subnormal.

Log(Half)

Computes the natural (base-E logarithm of a value.

Log(Half, Half)

Computes the logarithm of a value in the specified base.

Log10(Half)

Computes the base-10 logarithm of a value.

Log10P1(Half)

Computes the base-10 logarithm of a value plus one.

Log2(Half)

Computes the log2 of a value.

Log2P1(Half)

Computes the base-2 logarithm of a value plus one.

LogP1(Half)

Computes the natural (base-E) logarithm of a value plus one.

Max(Half, Half)

Compares two values to compute which is greater.

MaxMagnitude(Half, Half)

Compares two values to compute which is greater.

MaxMagnitudeNumber(Half, Half)

Compares two values to compute which has the greater magnitude and returning the other value if an input is NaN.

MaxNumber(Half, Half)

Compares two values to compute which is greater and returning the other value if an input is NaN.

Min(Half, Half)

Compares two values to compute which is lesser.

MinMagnitude(Half, Half)

Compares two values to compute which is lesser.

MinMagnitudeNumber(Half, Half)

Compares two values to compute which has the lesser magnitude and returning the other value if an input is NaN.

MinNumber(Half, Half)

Compares two values to compute which is lesser and returning the other value if an input is NaN.

Parse(ReadOnlySpan<Char>, IFormatProvider)

Parses a span of characters into a value.

Parse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider)

Converts the string representation of a number in a specified style and culture-specific format to its single-precision floating-point number equivalent.

Parse(String)

Converts the string representation of a number to its half-precision floating-point number equivalent.

Parse(String, IFormatProvider)

Converts the string representation of a number in a specified culture-specific format to its single-precision floating-point number equivalent.

Parse(String, NumberStyles)

Converts the string representation of a number in a specified style to its single-precision floating-point number equivalent.

Parse(String, NumberStyles, IFormatProvider)

Converts the string representation of a number in a specified style and culture-specific format to its single-precision floating-point number equivalent.

Pow(Half, Half)

Computes a value raised to a given power.

ReciprocalEstimate(Half)

Computes an estimate of the reciprocal of a value.

ReciprocalSqrtEstimate(Half)

Computes an estimate of the reciprocal square root of a value.

Root(Half, Int32)
Round(Half)

Rounds a value to the nearest integer using the default rounding mode (ToEven).

Round(Half, Int32)

Rounds a value to a specified number of fractional-digits using the default rounding mode (ToEven).

Round(Half, Int32, MidpointRounding)

Rounds a value to a specified number of fractional-digits using the default rounding mode (ToEven).

Round(Half, MidpointRounding)

Rounds a value to the nearest integer using the specified rounding mode.

ScaleB(Half, Int32)

Computes the product of a value and its base-radix raised to the specified power.

Sign(Half)

Computes the sign of a value.

Sin(Half)

Computes the sine of a value.

SinCos(Half)

Computes the sine and cosine of a value.

Sinh(Half)

Computes the hyperbolic sine of a value.

SinPi(Half)

Computes the sine of a value that has been multiplied by pi.

Sqrt(Half)

Computes the square-root of a value.

Tan(Half)

Computes the tangent of a value.

Tanh(Half)

Computes the hyperbolic tangent of a value.

TanPi(Half)

Computes the tangent of a value that has been multipled by pi.

ToString()

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

ToString(IFormatProvider)

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

ToString(String)

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

ToString(String, IFormatProvider)

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

Truncate(Half)

Truncates a value.

TryFormat(Span<Char>, Int32, ReadOnlySpan<Char>, IFormatProvider)

Tries to format the value of the current Half instance into the provided span of characters.

TryParse(ReadOnlySpan<Char>, Half)

Converts the span representation of a number to its half-precision floating-point number equivalent. A return value indicates whether the conversion succeeded or failed.

TryParse(ReadOnlySpan<Char>, IFormatProvider, Half)

Tries to parses a span of characters into a value.

TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, Half)

Converts the span representation of a number to its half-precision floating-point number equivalent. A return value indicates whether the conversion succeeded or failed.

TryParse(String, Half)

Converts the string representation of a number to its half-precision floating-point number equivalent. A return value indicates whether the conversion succeeded or failed.

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

Converts the string representation of a number to its half-precision floating-point number equivalent. A return value indicates whether the conversion succeeded or failed.

Operators

Addition(Half, Half)

Adds two values together to compute their sum.

CheckedExplicit(Half)
Decrement(Half)

Decrements a value.

Division(Half, Half)

Divides two values together to compute their quotient.

Equality(Half, Half)

Returns a value that indicates whether two specified Half values are equal.

Explicit(Char to Half)

Explicitly converts a Char value to its nearest representable half-precision floating-point value.

Explicit(Decimal to Half)

Explicitly converts a Decimal value to its nearest representable half-precision floating-point value.

Explicit(Double to Half)

An explicit operator to convert a Double value to a Half.

Explicit(Half to Byte)

Explicitly converts a half-precision floating-point value to its nearest representable Byte value.

Explicit(Half to Char)

Explicitly converts a half-precision floating-point value to its nearest representable Char value.

Explicit(Half to Decimal)

Explicitly converts a half-precision floating-point value to its nearest representable Decimal value.

Explicit(Half to Double)

An explicit operator to convert a Half value to a Double.

Explicit(Half to Int128)

Explicitly converts a half-precision floating-point value to its nearest representable Int128.

Explicit(Half to Int16)

Explicitly converts a half-precision floating-point value to its nearest representable Int16 value.

Explicit(Half to Int32)

Explicitly converts a half-precision floating-point value to its nearest representable Int32 value.

Explicit(Half to Int64)

Explicitly converts a half-precision floating-point value to its nearest representable Int64 value.

Explicit(Half to IntPtr)

Explicitly converts a half-precision floating-point value to its nearest representable IntPtr value.

Explicit(Half to SByte)

Explicitly converts a half-precision floating-point value to its nearest representable SByte value.

Explicit(Half to Single)

An explicit operator to convert a Half value to a Single.

Explicit(Half to UInt128)

Explicitly converts a half-precision floating-point value to its nearest representable UInt128.

Explicit(Half to UInt16)

Explicitly converts a half-precision floating-point value to its nearest representable UInt16 value.

Explicit(Half to UInt32)

Explicitly converts a half-precision floating-point value to its nearest representable UInt32 value.

Explicit(Half to UInt64)

Explicitly converts a half-precision floating-point value to its nearest representable UInt64 value.

Explicit(Half to UIntPtr)

Explicitly converts a half-precision floating-point value to its nearest representable UIntPtr value.

Explicit(Int16 to Half)

Explicitly converts a Int16 value to its nearest representable half-precision floating-point value.

Explicit(Int32 to Half)

Explicitly converts a Int32 value to its nearest representable half-precision floating-point value.

Explicit(Int64 to Half)

Explicitly converts a Int64 value to its nearest representable half-precision floating-point value.

Explicit(IntPtr to Half)

Explicitly converts a IntPtr value to its nearest representable half-precision floating-point value.

Explicit(Single to Half)

An explicit operator to convert a Single value to a Half.

Explicit(UInt16 to Half)

Explicitly converts a UInt16 value to its nearest representable half-precision floating-point value.

Explicit(UInt32 to Half)

Explicitly converts a UInt32 value to its nearest representable half-precision floating-point value.

Explicit(UInt64 to Half)

Explicitly converts a UInt64 value to its nearest representable half-precision floating-point value.

Explicit(UIntPtr to Half)

Explicitly converts a UIntPtr value to its nearest representable half-precision floating-point value.

GreaterThan(Half, Half)

Returns a value that indicates whether a specified Half value is greater than another specified Half value.

GreaterThanOrEqual(Half, Half)

Returns a value that indicates whether left is greater than or equal to right.

Implicit(Byte to Half)

Implicitly converts a Byte value to its nearest representable half-precision floating-point value.

Implicit(SByte to Half)

Implicitly converts a SByte value to its nearest representable half-precision floating-point value.

Increment(Half)

Increments a value.

Inequality(Half, Half)

Returns a value that indicates whether two specified Half values are not equal.

LessThan(Half, Half)

Returns a value that indicates whether a specified Half value is less than another specified Half value.

LessThanOrEqual(Half, Half)

Returns a value that indicates whether a specified Half value is less than or equal to another specified Half value.

Modulus(Half, Half)

Divides two values together to compute their modulus or remainder.

Multiply(Half, Half)

Multiplies two values together to compute their product.

Subtraction(Half, Half)

Subtracts two values to compute their difference.

UnaryNegation(Half)

Computes the unary negation of a value.

UnaryPlus(Half)

Computes the unary plus of a value.

Explicit Interface Implementations

IFloatingPoint<Half>.GetExponentByteCount()

Gets the number of bytes that will be written as part of TryWriteExponentLittleEndian(Span<Byte>, Int32).

IFloatingPoint<Half>.GetExponentShortestBitLength()

Gets the length, in bits, of the shortest two's complement representation of the current exponent.

IFloatingPoint<Half>.GetSignificandBitLength()

Gets the length, in bits, of the current significand.

IFloatingPoint<Half>.GetSignificandByteCount()

Gets the number of bytes that will be written as part of TryWriteSignificandLittleEndian(Span<Byte>, Int32).

IFloatingPoint<Half>.TryWriteExponentBigEndian(Span<Byte>, Int32)

Tries to write the current exponent, in big-endian format, to a given span.

IFloatingPoint<Half>.TryWriteExponentLittleEndian(Span<Byte>, Int32)

Tries to write the current exponent, in little-endian format, to a given span.

IFloatingPoint<Half>.TryWriteSignificandBigEndian(Span<Byte>, Int32)

Tries to write the current significand, in big-endian format, to a given span.

IFloatingPoint<Half>.TryWriteSignificandLittleEndian(Span<Byte>, Int32)

Tries to write the current significand, in little-endian format, to a given span.

Applies to

See also