![]() |
SystemEX
Lacking
Additional generic collection types missing in .net
|
Public Member Functions | |
| Half16 (ushort value) | |
| Creates a Half16 from a raw 16‑bit value. | |
| Half16 (ushort sign, ushort exponent, ushort mantissa) | |
| Creates a Half16 from explicit sign, exponent, and mantissa fields. | |
| ushort | AsUShort () |
| Returns the raw 16‑bit representation. | |
| byte[] | ToBytes (Endian endian) |
| Converts the value into a byte array using the specified endianness. | |
| CompareResult | CompareTo (Half16 b) |
| Compares this instance with another Half16 and returns a CompareResult describing the relationship. | |
| override int | GetHashCode () |
| Returns a hash code for this instance. | |
| bool | Equals (Half16 other) |
| Determines whether this instance is equal to another Half16 value, using the same semantics as the operator ==(Half16,Half16). | |
| override bool | Equals (object? obj) |
| Determines whether this instance is equal to another object. | |
| int | CompareTo (object? obj) |
| Compares this instance with another object and returns an integer indicating the relative order, following the standard IComparable contract. | |
| int IComparable< Half16 >. | CompareTo (Half16 other) |
| Explicit IComparable<T> implementation that forwards to the extended CompareTo(Half16) method and casts the CompareResult to int. | |
| FixedVector< byte > | ToBytes () |
| Converts this instance into a deterministic byte array suitable for hashing, serialization, or low‑level processing. | |
| Public Member Functions inherited from SystemEx.IComparableEx< T > | |
| CompareResult | CompareTo (T a) |
| Compares this instance with the specified value and returns a CompareResult describing the relationship between them. | |
Static Public Member Functions | |
| static Half16 | Max (Half16 x, Half16 y) |
| Returns the larger of two Half16 values. | |
| static Half16 | Min (Half16 x, Half16 y) |
| Returns the smaller of two Half16 values. | |
| static Half16 | Abs (Half16 x) |
| Returns the absolute value of the given Half16. | |
| static Half16 | FromBytes (byte[] input, int offsets, Endian endian) |
| Constructs a Half16 from a byte array. | |
| static bool | IsZero (Half16 value) |
| Returns true if the value is +0 or −0. | |
| static bool | IsNegative (Half16 val) |
| Returns true if the value is negative. | |
| static bool | IsNaN (Half16 val) |
| Returns true if the value is a NaN. | |
| static bool | IsInfinity (Half16 val) |
| Returns true if the value is ±infinity. | |
| static Half16 | Signum (Half16 x) |
| Returns −1, 0, or +1 depending on the sign of the value. | |
| static Half16 | Clamp (Half16 x, Half16 min, Half16 max) |
| Clamps the value between the specified minimum and maximum. | |
| static bool | IsFinite (Half16 x) |
| Returns true if the value is finite (not NaN or infinity). | |
| static bool | IsSubnormal (Half16 x) |
| Returns true if the value is a subnormal number. | |
| static bool | IsNormal (Half16 x) |
| Returns true if the value is a normal (non‑subnormal, non‑special) number. | |
| static Half16 | Floor (Half16 x) |
| Computes the floor of the value. | |
| static Half16 | Ceil (Half16 x) |
| Computes the ceiling of the value. | |
| static Half16 | Trunc (Half16 x) |
| Truncates the fractional part of the value. | |
| static bool | IsInteger (Half16 x) |
| Returns true if the value is an integer. | |
| static bool | operator< (Half16 a, Half16 b) |
| Less‑than comparison operator with full IEEE‑754 semantics. | |
| static bool | operator<= (Half16 a, Half16 b) |
| Less‑than‑or‑equal comparison operator. | |
| static bool | operator> (Half16 a, Half16 b) |
| Greater‑than operator. | |
| static bool | operator>= (Half16 a, Half16 b) |
| Greater‑than‑or‑equal operator. | |
| static bool | operator!= (Half16 a, Half16 b) |
| Inequality operator. | |
| static Half16 | operator+ (Half16 a, Half16 b) |
| Addition operator. | |
| static Half16 | operator- (Half16 a, Half16 b) |
| Subtraction operator. | |
| static Half16 | operator* (Half16 a, Half16 b) |
| Multiplication operator. | |
| static Half16 | operator/ (Half16 a, Half16 b) |
| Division operator. | |
| static Half16 | operator++ (Half16 a) |
| Increment operator. | |
| static Half16 | operator-- (Half16 a) |
| Decrement operator. | |
| static Half16 | Normalize (ushort sign, int exp, uint mant) |
| Normalizes a mantissa/exponent pair into a valid Half16 value. | |
| static uint | RoundToNearestEven (uint mant) |
| Rounds a mantissa using round‑to‑nearest‑even. | |
| static Half16 | Negate (Half16 h) |
| Returns the negated value. | |
| static bool | operator== (Half16 a, Half16 b) |
| Equality operator with IEEE‑754 zero handling. | |
| static Half16 | Mul (Half16 a, Half16 b) |
| Multiplies two Half16 values using full bit‑level arithmetic. | |
| static Half16 | Add (Half16 a, Half16 b) |
| Adds two Half16 values using full IEEE‑754 style mantissa/exponent arithmetic, including handling of special values such as NaN, infinities, and signed zero. | |
| static Half16 | Div (Half16 a, Half16 b) |
| Divides one Half16 value by another using full mantissa/exponent arithmetic. | |
Properties | |
| ushort | SignBits [get] |
| Number of bits used for the sign field (always 1). | |
| ushort | ExponentBits [get] |
| Number of bits used for the exponent field (IEEE‑754 binary16 uses 5). | |
| ushort | MantissaBits [get] |
| Number of bits used for the mantissa (fraction) field (10 bits). | |
| ushort | ExponentBias [get] |
| Exponent bias used by the binary16 format (15). | |
| ushort | TotalBits [get] |
| Total number of bits in the representation (16). | |
| bool | Sign [get] |
| Gets the sign bit (true = negative). | |
| ushort | Exponent [get] |
| Gets the exponent field (5 bits). | |
| ushort | Mantissa [get] |
| Gets the mantissa (fraction) field (10 bits). | |
| static Half16 | Zero [get] |
| Represents +0. | |
| static Half16 | One [get] |
| Represents +1. | |
| static Half16 | NegativeOne [get] |
| Represents −1. | |
| static Half16 | PositiveInfinity [get] |
| Represents positive infinity. | |
| static Half16 | NegativeInfinity [get] |
| Represents negative infinity. | |
| static Half16 | Epsilon [get] |
| Smallest representable positive increment. | |
| static Half16 | NaN [get] |
| Quiet NaN value. | |
| static Half16 | NaN2 [get] |
| Alternative NaN encoding. | |
| static Half16 | MinValue [get] |
| Smallest representable negative value. | |
| static Half16 | MaxValue [get] |
| Largest representable positive value. | |
| static Half16 | E [get] |
| Euler's number (approximation). | |
| static Half16 | Pi [get] |
| π (approximation). | |
| static Half16 | Tau [get] |
| τ = 2π (approximation). | |
| SystemEx.Numeric.Half16.Half16 | ( | ushort | value | ) |
Creates a Half16 from a raw 16‑bit value.
| SystemEx.Numeric.Half16.Half16 | ( | ushort | sign, |
| ushort | exponent, | ||
| ushort | mantissa ) |
Creates a Half16 from explicit sign, exponent, and mantissa fields.
Returns the absolute value of the given Half16.
Adds two Half16 values using full IEEE‑754 style mantissa/exponent arithmetic, including handling of special values such as NaN, infinities, and signed zero.
The operation is performed entirely in the half‑precision domain without converting to float or double.
| a | The left operand. |
| b | The right operand. |
a + b as a Half16 value. If the operation is undefined (e.g. +∞ + −∞), NaN is returned. | ushort SystemEx.Numeric.Half16.AsUShort | ( | ) |
Computes the ceiling of the value.
Clamps the value between the specified minimum and maximum.
| CompareResult SystemEx.Numeric.Half16.CompareTo | ( | Half16 | b | ) |
Compares this instance with another Half16 and returns a CompareResult describing the relationship.
NaN is treated as unordered: if this instance is NaN and the other is not, the result is CompareResult.AIsSmallerB to provide a deterministic ordering for sorting and data structures.
| b | The value to compare with this instance. |
Explicit IComparable<T> implementation that forwards to the extended CompareTo(Half16) method and casts the CompareResult to int.
This keeps the standard .NET comparison API compatible while still exposing a strongly typed comparison result via IComparableEx<Half16>.
| other | The value to compare with. |
| int SystemEx.Numeric.Half16.CompareTo | ( | object? | obj | ) |
Compares this instance with another object and returns an integer indicating the relative order, following the standard IComparable contract.
If obj is a Half16, the comparison is delegated to CompareTo(Half16) and the resulting CompareResult is cast to int.
| obj | The object to compare with. |
| ArgumentException | Thrown if obj is not a Half16. |
Divides one Half16 value by another using full mantissa/exponent arithmetic.
The operation is performed entirely in half‑precision and handles special values (NaN, infinities, signed zero) according to IEEE‑754‑like rules.
| a | The dividend. |
| b | The divisor. |
a / b as a Half16 value. If the operation is undefined (e.g. division by zero, ∞ / ∞), NaN is returned. | bool SystemEx.Numeric.Half16.Equals | ( | Half16 | other | ) |
Determines whether this instance is equal to another Half16 value, using the same semantics as the operator ==(Half16,Half16).
| other | The value to compare with. |
true if the values are equal; otherwise false. | override bool SystemEx.Numeric.Half16.Equals | ( | object? | obj | ) |
Determines whether this instance is equal to another object.
The object is considered equal if it is a Half16 and compares equal using Equals(Half16).
| obj | The object to compare with. |
true if obj is a Half16 and equal to this instance; otherwise false. Computes the floor of the value.
Constructs a Half16 from a byte array.
| override int SystemEx.Numeric.Half16.GetHashCode | ( | ) |
Returns a hash code for this instance.
The hash is computed using HashFactory.Hash32<T>(T,uint) with a fixed seed. If the computed hash is non‑zero, it is used; otherwise the raw ushort value is hashed.
This ensures a deterministic, stable hash suitable for use in dictionaries, sets, and other hash‑based containers.
|
static |
Returns true if the value is finite (not NaN or infinity).
|
static |
Returns true if the value is ±infinity.
|
static |
Returns true if the value is an integer.
|
static |
Returns true if the value is a NaN.
|
static |
Returns true if the value is negative.
|
static |
Returns true if the value is a normal (non‑subnormal, non‑special) number.
|
static |
Returns true if the value is a subnormal number.
|
static |
Returns true if the value is +0 or −0.
Returns the larger of two Half16 values.
Returns the smaller of two Half16 values.
Multiplies two Half16 values using full bit‑level arithmetic.
Returns the negated value.
|
static |
Normalizes a mantissa/exponent pair into a valid Half16 value.
Inequality operator.
Multiplication operator.
Addition operator.
Increment operator.
Subtraction operator.
Decrement operator.
Division operator.
Less‑than comparison operator with full IEEE‑754 semantics.
Less‑than‑or‑equal comparison operator.
Equality operator with IEEE‑754 zero handling.
Greater‑than operator.
Greater‑than‑or‑equal operator.
|
static |
Rounds a mantissa using round‑to‑nearest‑even.
Returns −1, 0, or +1 depending on the sign of the value.
| FixedVector< byte > SystemEx.Numeric.Half16.ToBytes | ( | ) |
Converts this instance into a deterministic byte array suitable for hashing, serialization, or low‑level processing.
The returned array contains the raw 16‑bit representation of the value in the system's native endianness, wrapped in a SystemEx FixedVector<T>.
Implements SystemEx.Hash.IHashable< T >.
| byte[] SystemEx.Numeric.Half16.ToBytes | ( | Endian | endian | ) |
Converts the value into a byte array using the specified endianness.
Implements SystemEx.Numeric.IHalf< T >.
Truncates the fractional part of the value.
|
staticget |
Euler's number (approximation).
|
staticget |
Smallest representable positive increment.
|
get |
Gets the exponent field (5 bits).
Implements SystemEx.Numeric.IHalf< T >.
|
get |
Exponent bias used by the binary16 format (15).
Implements SystemEx.Numeric.IHalf< T >.
|
get |
Number of bits used for the exponent field (IEEE‑754 binary16 uses 5).
Implements SystemEx.Numeric.IHalf< T >.
|
get |
Gets the mantissa (fraction) field (10 bits).
Implements SystemEx.Numeric.IHalf< T >.
|
get |
Number of bits used for the mantissa (fraction) field (10 bits).
Implements SystemEx.Numeric.IHalf< T >.
|
staticget |
Largest representable positive value.
|
staticget |
Smallest representable negative value.
|
staticget |
Quiet NaN value.
|
staticget |
Alternative NaN encoding.
|
staticget |
Represents negative infinity.
|
staticget |
Represents −1.
|
staticget |
Represents +1.
|
staticget |
π (approximation).
|
staticget |
Represents positive infinity.
|
get |
Gets the sign bit (true = negative).
Implements SystemEx.Numeric.IHalf< T >.
|
get |
Number of bits used for the sign field (always 1).
Implements SystemEx.Numeric.IHalf< T >.
|
staticget |
τ = 2π (approximation).
|
get |
Total number of bits in the representation (16).
Implements SystemEx.Numeric.IHalf< T >.
|
staticget |
Represents +0.