SystemEX  Lacking
Additional generic collection types missing in .net
SystemEx.Numeric.Half16 Struct Reference
Inheritance diagram for SystemEx.Numeric.Half16:
Collaboration diagram for SystemEx.Numeric.Half16:

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).

Constructor & Destructor Documentation

◆ Half16() [1/2]

SystemEx.Numeric.Half16.Half16 ( ushort value)

Creates a Half16 from a raw 16‑bit value.

166 {
167 m_value = value;
168 }
Here is the caller graph for this function:

◆ Half16() [2/2]

SystemEx.Numeric.Half16.Half16 ( ushort sign,
ushort exponent,
ushort mantissa )

Creates a Half16 from explicit sign, exponent, and mantissa fields.

173 {
174 m_value = (ushort)((sign << 15) | (exponent << 10) | mantissa);
175 }

Member Function Documentation

◆ Abs()

Half16 SystemEx.Numeric.Half16.Abs ( Half16 x)
static

Returns the absolute value of the given Half16.

159 =>
160 new Half16(0, x.Exponent, x.Mantissa);
Here is the call graph for this function:

◆ Add()

Half16 SystemEx.Numeric.Half16.Add ( Half16 a,
Half16 b )
static

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.

Parameters
aThe left operand.
bThe right operand.
Returns
The sum a + b as a Half16 value. If the operation is undefined (e.g. +∞ + −∞), NaN is returned.
517 {
518 if ( IsNaN(a) || IsNaN(b) ) return Half16.NaN;
519 if ( IsInfinity(a) && IsInfinity(b) && a.Sign != b.Sign ) return Half16.NaN;
520
521 // Sonderfälle
522 if ( IsInfinity(a) ) return a;
523 if ( IsInfinity(b) ) return b;
524
525 if ( IsZero(a) ) return b;
526 if ( IsZero(b) ) return a;
527
528 ushort expA = a.Exponent;
529 ushort expB = b.Exponent;
530
531 uint mantA = (expA == 0) ? a.Mantissa : (uint)(a.Mantissa | 0x400);
532 uint mantB = (expB == 0) ? b.Mantissa: (uint)(b.Mantissa | 0x400);
533
534 int exp = expA;
535
536 int diff = expA - expB;
537
538 if ( diff > 0 ) {
539 mantB >>= diff;
540 } else if ( diff < 0 ) {
541 mantA >>= -diff;
542 exp = expB;
543 }
544
545 uint mant;
546 ushort sign;
547
548 if ( a.Sign == b.Sign ) {
549 mant = mantA + mantB;
550 sign = (ushort)(a.Sign ? 1 : 0);
551 } else {
552 if ( mantA >= mantB ) {
553 mant = mantA - mantB;
554 sign = (ushort)(a.Sign ? 1 : 0);
555 } else {
556 mant = mantB - mantA;
557 sign = (ushort)(b.Sign ? 1 : 0);
558 }
559 }
560
561 if ( mant == 0 ) return new Half16(0, 0, 0);
562
563 while ( (mant & 0x400) == 0 ) {
564 mant <<= 1;
565 exp--;
566 }
567
568 return Normalize(sign, exp, mant);
569 }
Here is the call graph for this function:

◆ AsUShort()

ushort SystemEx.Numeric.Half16.AsUShort ( )

Returns the raw 16‑bit representation.

Implements SystemEx.Numeric.IHalf< T >.

180=> m_value;

◆ Ceil()

Half16 SystemEx.Numeric.Half16.Ceil ( Half16 x)
static

Computes the ceiling of the value.

279 {
280 if ( IsNaN(x) || IsInfinity(x) ) return x;
281
282 ushort e = x.Exponent;
283
284 if ( e >= 15 ) {
285 int shift = e - 15;
286 uint mant = (uint)(x.Mantissa | 0x400);
287 mant >>= shift;
288 mant <<= shift;
289 return new Half16((ushort)(x.Sign ? 1 : 0), e, (ushort)(mant & 0x3FF));
290 }
291
292 if ( IsZero(x) ) return x;
293
294 return x.Sign ? Zero : One;
295 }
Here is the call graph for this function:

◆ Clamp()

Half16 SystemEx.Numeric.Half16.Clamp ( Half16 x,
Half16 min,
Half16 max )
static

Clamps the value between the specified minimum and maximum.

231 {
232 if ( x < min ) return min;
233 if ( x > max ) return max;
234 return x;
235 }
Here is the call graph for this function:

◆ CompareTo() [1/3]

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.

Parameters
bThe value to compare with this instance.
Returns
A CompareResult indicating whether this instance is smaller than, equal to, or larger than b .
633 {
634 CompareResult _ret = CompareResult.Equal;
635
636 if ( IsNaN(this) && !IsNaN(b) ) _ret = CompareResult.AIsSmallerB;
637
638 else {
639 if ( this < b ) _ret = CompareResult.AIsSmallerB;
640 else if ( this > b ) _ret = CompareResult.AIsLargerB;
641 }
642
643 return _ret;
644 }
CompareResult
Specifies the result of a comparison between two values.
Definition Algorithm.cs:26
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CompareTo() [2/3]

int IComparable< Half16 >. SystemEx.Numeric.Half16.CompareTo ( Half16 other)

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>.

Parameters
otherThe value to compare with.
Returns
A signed integer indicating the relative order.
729 {
730 return (int)CompareTo(other);
731 }
Here is the call graph for this function:

◆ CompareTo() [3/3]

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.

Parameters
objThe object to compare with.
Returns
A signed integer indicating the relative order: negative if this instance is smaller, zero if equal, positive if larger.
Exceptions
ArgumentExceptionThrown if obj is not a Half16.
710 {
711 if ( (obj is Half16) ) {
712 return (int)CompareTo((Half16)(obj));
713 }
714 throw new ArgumentException("Object is not a Float16 object");
715 }
Here is the call graph for this function:

◆ Div()

Half16 SystemEx.Numeric.Half16.Div ( Half16 a,
Half16 b )
static

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.

Parameters
aThe dividend.
bThe divisor.
Returns
The quotient a / b as a Half16 value. If the operation is undefined (e.g. division by zero, ∞ / ∞), NaN is returned.
586 {
587 if ( IsNaN(a) || IsNaN(b) ) return Half16.NaN;
588 if ( IsZero(b) ) return Half16.NaN;
589 if ( IsZero(a) ) return Half16.Zero;
590
591 if ( IsInfinity(a) && IsInfinity(b) ) return Half16.NaN;
592
593 ushort sign = (ushort)((a.Sign ? 1 : 0) ^ (b.Sign ? 1 : 0) );
594
595 if ( IsInfinity(a) ) {
596 return new Half16(sign, 0x1F, 0);
597 }
598 if ( IsInfinity(b) ) return Half16.Zero;
599
600 ushort expA = a.Exponent;
601 ushort expB = b.Exponent;
602
603 uint mantA = (expA == 0) ? a.Mantissa : (uint)(a.Mantissa | 0x400);
604 uint mantB = (expB == 0) ? b.Mantissa: (uint)(b.Mantissa | 0x400);
605
606 int exp = expA - expB + 15;
607
608 uint mant = (mantA << 13) / mantB;
609
610 while ( (mant & 0x400) == 0 ) {
611 mant <<= 1;
612 exp--;
613 }
614
615 return Normalize(sign, exp, mant);
616 }
Here is the call graph for this function:

◆ Equals() [1/2]

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).

Parameters
otherThe value to compare with.
Returns
true if the values are equal; otherwise false.
671 {
672 return this == other;
673 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Equals() [2/2]

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).

Parameters
objThe object to compare with.
Returns
true if obj is a Half16 and equal to this instance; otherwise false.
686 {
687 if ( obj == null ) return false;
688 return (obj is Half16) && Equals((Half16)obj);
689 }
Here is the call graph for this function:

◆ Floor()

Half16 SystemEx.Numeric.Half16.Floor ( Half16 x)
static

Computes the floor of the value.

258 {
259 if ( IsNaN(x) || IsInfinity(x) ) return x;
260
261 ushort e = x.Exponent;
262
263 if ( e >= 15 ) {
264 int shift = e - 15;
265 uint mant = (uint)(x.Mantissa | 0x400);
266 mant >>= shift;
267 mant <<= shift;
268 return new Half16((ushort)(x.Sign ? 1 : 0), e, (ushort)(mant & 0x3FF));
269 }
270
271 if ( IsZero(x) ) return x;
272
273 return x.Sign ? NegativeOne : Zero;
274 }
Here is the call graph for this function:

◆ FromBytes()

Half16 SystemEx.Numeric.Half16.FromBytes ( byte[] input,
int offsets,
Endian endian )
static

Constructs a Half16 from a byte array.

191 {
192 ushort value = input.ToUShort(offsets, endian);
193 return new Half16(value);
194 }
Here is the call graph for this function:

◆ GetHashCode()

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.

656 {
657 var x = HashFactory.Hash32(this, 674545);
658 if(x.Value != 0) return (int)x.Value;
659
660 return m_value.GetHashCode();
661 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsFinite()

bool SystemEx.Numeric.Half16.IsFinite ( Half16 x)
static

Returns true if the value is finite (not NaN or infinity).

239 =>
240 x.Exponent != 0x1F;
Here is the call graph for this function:

◆ IsInfinity()

bool SystemEx.Numeric.Half16.IsInfinity ( Half16 val)
static

Returns true if the value is ±infinity.

216 =>
217 (val.Exponent == 0x1F) && (val.Mantissa == 0);
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsInteger()

bool SystemEx.Numeric.Half16.IsInteger ( Half16 x)
static

Returns true if the value is an integer.

319 {
320 if ( IsNaN(x) || IsInfinity(x) ) return false;
321
322 ushort e = x.Exponent;
323
324 if ( e < 15 ) return IsZero(x);
325
326 int shift = e - 15;
327 uint mant = (uint)(x.Mantissa | 0x400);
328
329 return (mant & ((1u << shift) - 1)) == 0;
330 }
Here is the call graph for this function:

◆ IsNaN()

bool SystemEx.Numeric.Half16.IsNaN ( Half16 val)
static

Returns true if the value is a NaN.

210 =>
211 (val.Exponent == 0x1F) && (val.Mantissa != 0);
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsNegative()

bool SystemEx.Numeric.Half16.IsNegative ( Half16 val)
static

Returns true if the value is negative.

204 =>
205 (val.m_value & 0x8000) != 0;
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsNormal()

bool SystemEx.Numeric.Half16.IsNormal ( Half16 x)
static

Returns true if the value is a normal (non‑subnormal, non‑special) number.

251 {
252 ushort e = x.Exponent;
253 return e != 0 && e != 0x1F;
254 }
Here is the call graph for this function:

◆ IsSubnormal()

bool SystemEx.Numeric.Half16.IsSubnormal ( Half16 x)
static

Returns true if the value is a subnormal number.

245 =>
246 x.Exponent == 0 && x.Mantissa != 0;
Here is the call graph for this function:

◆ IsZero()

bool SystemEx.Numeric.Half16.IsZero ( Half16 value)
static

Returns true if the value is +0 or −0.

198 =>
199 (value.m_value & ~0x8000) == 0;
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Max()

Half16 SystemEx.Numeric.Half16.Max ( Half16 x,
Half16 y )
static

Returns the larger of two Half16 values.

149=> (x > y) ? x : y;
Here is the call graph for this function:

◆ Min()

Half16 SystemEx.Numeric.Half16.Min ( Half16 x,
Half16 y )
static

Returns the smaller of two Half16 values.

154=> (x < y) ? x : y;
Here is the call graph for this function:

◆ Mul()

Half16 SystemEx.Numeric.Half16.Mul ( Half16 a,
Half16 b )
static

Multiplies two Half16 values using full bit‑level arithmetic.

472 {
473 if ( IsNaN(a) || IsNaN(b) ) return Half16.NaN;
474 if ( IsZero(a) || IsZero(b) ) return Half16.Zero;
475
476 ushort sign = (ushort)((a.Sign ? 1 : 0) ^ (b.Sign ? 1 : 0) );
477
478 if ( IsInfinity(a) || IsInfinity(b) ) {
479 return new Half16(sign, 0x1F, 0);
480 }
481
482 ushort expA = a.Exponent;
483 ushort expB = b.Exponent;
484
485 uint mantA = (expA == 0) ? a.Mantissa : (uint)(a.Mantissa | 0x400);
486 uint mantB = (expB == 0) ? b.Mantissa: (uint)(b.Mantissa | 0x400);
487
488 int exp = expA + expB - 15;
489
490 uint mant = mantA * mantB; // bis zu 20 Bits
491
492 // Normalisieren
493 while ( (mant & 0x80000) != 0 ) {
494 mant >>= 1;
495 exp++;
496 }
497
498 mant >>= 10; // zurück auf 11 Bits (leading + 10 mantissa)
499
500 return Normalize(sign, exp, mant);
501 }
Here is the call graph for this function:

◆ Negate()

Half16 SystemEx.Numeric.Half16.Negate ( Half16 h)
static

Returns the negated value.

455 {
456 ushort sign = (ushort)(h.Sign ? 1 : 0);
457 return new Half16((ushort)(sign ^ 1), h.Exponent, h.Mantissa);
458 }
Here is the call graph for this function:

◆ Normalize()

Half16 SystemEx.Numeric.Half16.Normalize ( ushort sign,
int exp,
uint mant )
static

Normalizes a mantissa/exponent pair into a valid Half16 value.

416 {
417 if ( mant == 0 ) return new Half16(sign, 0, 0);
418
419 while ( (mant & 0x400) == 0 ) {
420 mant <<= 1;
421 exp--;
422 }
423
424 if ( exp <= 0 )
425 return new Half16(sign, 0, (ushort)(mant >> (1 - exp)));
426
427 if ( exp >= 31 )
428 return new Half16(sign, 0x1F, 0);
429
430 ushort finalMant = (ushort)(mant & 0x3FF);
431
432 return new Half16(sign, (ushort)exp, finalMant);
433 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator!=()

bool SystemEx.Numeric.Half16.operator!= ( Half16 a,
Half16 b )
static

Inequality operator.

381=> !(a == b);
Here is the call graph for this function:

◆ operator*()

Half16 SystemEx.Numeric.Half16.operator* ( Half16 a,
Half16 b )
static

Multiplication operator.

396=> Mul(a, b);
Here is the call graph for this function:

◆ operator+()

Half16 SystemEx.Numeric.Half16.operator+ ( Half16 a,
Half16 b )
static

Addition operator.

386=> Add(a, b);
@ Add
Adds the layer’s color value to the underlying color. Useful for additive accumulation or brightness‑...
Definition ICanvasList.cs:37
Here is the call graph for this function:

◆ operator++()

Half16 SystemEx.Numeric.Half16.operator++ ( Half16 a)
static

Increment operator.

406=> a + One;
Here is the call graph for this function:

◆ operator-()

Half16 SystemEx.Numeric.Half16.operator- ( Half16 a,
Half16 b )
static

Subtraction operator.

391=> a + Negate(b);
Here is the call graph for this function:

◆ operator--()

Half16 SystemEx.Numeric.Half16.operator-- ( Half16 a)
static

Decrement operator.

411=> a - One;
Here is the call graph for this function:

◆ operator/()

Half16 SystemEx.Numeric.Half16.operator/ ( Half16 a,
Half16 b )
static

Division operator.

401=> Div(a, b);
Here is the call graph for this function:

◆ operator<()

bool SystemEx.Numeric.Half16.operator< ( Half16 a,
Half16 b )
static

Less‑than comparison operator with full IEEE‑754 semantics.

336 {
337 if ( IsNaN(a) || IsNaN(b) ) return false;
338
339 bool _neg = IsNegative(a);
340
341 if ( _neg != IsNegative(b) ) {
342 if ( IsZero(a) && IsZero(b) )
343 return false;
344 return _neg;
345 }
346
347 return (a.m_value != b.m_value) && ((a.m_value < b.m_value) ^ _neg);
348 }
Here is the call graph for this function:

◆ operator<=()

bool SystemEx.Numeric.Half16.operator<= ( Half16 a,
Half16 b )
static

Less‑than‑or‑equal comparison operator.

353 {
354 if ( IsNaN(a) || IsNaN(b) ) return false;
355
356 bool _neg = IsNegative(a);
357
358 if ( _neg != IsNegative(b) ) {
359 if ( IsZero(a) && IsZero(b) )
360 return true;
361 return _neg;
362 }
363
364 return (a.m_value == b.m_value) || ((a.m_value < b.m_value) ^ _neg);
365 }
Here is the call graph for this function:

◆ operator==()

bool SystemEx.Numeric.Half16.operator== ( Half16 a,
Half16 b )
static

Equality operator with IEEE‑754 zero handling.

464 {
465 if ( IsNaN(a) || IsNaN(b) ) return false;
466 return (a.m_value == b.m_value) || (IsZero(a) && IsZero(b));
467 }
Here is the call graph for this function:

◆ operator>()

bool SystemEx.Numeric.Half16.operator> ( Half16 a,
Half16 b )
static

Greater‑than operator.

371=> b < a;
Here is the call graph for this function:

◆ operator>=()

bool SystemEx.Numeric.Half16.operator>= ( Half16 a,
Half16 b )
static

Greater‑than‑or‑equal operator.

376=> b <= a;
Here is the call graph for this function:

◆ RoundToNearestEven()

uint SystemEx.Numeric.Half16.RoundToNearestEven ( uint mant)
static

Rounds a mantissa using round‑to‑nearest‑even.

438 {
439 uint guard = (mant >> 2) & 1;
440 uint round = (mant >> 1) & 1;
441 uint sticky = mant & 1;
442
443 uint add = 0;
444
445 if ( round != 0 ) {
446 if ( guard != 0 || sticky != 0 )
447 add = 1;
448 }
449
450 return (mant >> 3) + add;
451 }

◆ Signum()

Half16 SystemEx.Numeric.Half16.Signum ( Half16 x)
static

Returns −1, 0, or +1 depending on the sign of the value.

222 {
223 if ( IsNaN(x) ) return Half16.NaN;
224 if ( IsZero(x) ) return Half16.Zero;
225 return x.Sign ? Half16.NegativeOne : Half16.One;
226 }
Here is the call graph for this function:

◆ ToBytes() [1/2]

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>.

Returns
A new FixedVector<T> containing the raw bytes of this Half16 value.

Implements SystemEx.Hash.IHashable< T >.

744 {
745 return new FixedVector<byte>(m_value.ToBytes());
746 }

◆ ToBytes() [2/2]

byte[] SystemEx.Numeric.Half16.ToBytes ( Endian endian)

Converts the value into a byte array using the specified endianness.

Implements SystemEx.Numeric.IHalf< T >.

185 =>
186 m_value.ToBytes(endian);

◆ Trunc()

Half16 SystemEx.Numeric.Half16.Trunc ( Half16 x)
static

Truncates the fractional part of the value.

300 {
301 if ( IsNaN(x) || IsInfinity(x) ) return x;
302
303 ushort e = x.Exponent;
304
305 if ( e >= 15 ) {
306 int shift = e - 15;
307 uint mant = (uint)(x.Mantissa | 0x400);
308 mant >>= shift;
309 mant <<= shift;
310 return new Half16((ushort)(x.Sign ? 1 : 0), e, (ushort)(mant & 0x3FF));
311 }
312
313 return Zero;
314 }
Here is the call graph for this function:

Property Documentation

◆ E

Half16 SystemEx.Numeric.Half16.E
staticget

Euler's number (approximation).

◆ Epsilon

Half16 SystemEx.Numeric.Half16.Epsilon
staticget

Smallest representable positive increment.

◆ Exponent

ushort SystemEx.Numeric.Half16.Exponent
get

Gets the exponent field (5 bits).

Implements SystemEx.Numeric.IHalf< T >.

◆ ExponentBias

ushort SystemEx.Numeric.Half16.ExponentBias
get

Exponent bias used by the binary16 format (15).

Implements SystemEx.Numeric.IHalf< T >.

◆ ExponentBits

ushort SystemEx.Numeric.Half16.ExponentBits
get

Number of bits used for the exponent field (IEEE‑754 binary16 uses 5).

Implements SystemEx.Numeric.IHalf< T >.

◆ Mantissa

ushort SystemEx.Numeric.Half16.Mantissa
get

Gets the mantissa (fraction) field (10 bits).

Implements SystemEx.Numeric.IHalf< T >.

◆ MantissaBits

ushort SystemEx.Numeric.Half16.MantissaBits
get

Number of bits used for the mantissa (fraction) field (10 bits).

Implements SystemEx.Numeric.IHalf< T >.

◆ MaxValue

Half16 SystemEx.Numeric.Half16.MaxValue
staticget

Largest representable positive value.

◆ MinValue

Half16 SystemEx.Numeric.Half16.MinValue
staticget

Smallest representable negative value.

◆ NaN

Half16 SystemEx.Numeric.Half16.NaN
staticget

Quiet NaN value.

◆ NaN2

Half16 SystemEx.Numeric.Half16.NaN2
staticget

Alternative NaN encoding.

◆ NegativeInfinity

Half16 SystemEx.Numeric.Half16.NegativeInfinity
staticget

Represents negative infinity.

◆ NegativeOne

Half16 SystemEx.Numeric.Half16.NegativeOne
staticget

Represents −1.

◆ One

Half16 SystemEx.Numeric.Half16.One
staticget

Represents +1.

◆ Pi

Half16 SystemEx.Numeric.Half16.Pi
staticget

π (approximation).

◆ PositiveInfinity

Half16 SystemEx.Numeric.Half16.PositiveInfinity
staticget

Represents positive infinity.

◆ Sign

bool SystemEx.Numeric.Half16.Sign
get

Gets the sign bit (true = negative).

Implements SystemEx.Numeric.IHalf< T >.

◆ SignBits

ushort SystemEx.Numeric.Half16.SignBits
get

Number of bits used for the sign field (always 1).

Implements SystemEx.Numeric.IHalf< T >.

◆ Tau

Half16 SystemEx.Numeric.Half16.Tau
staticget

τ = 2π (approximation).

◆ TotalBits

ushort SystemEx.Numeric.Half16.TotalBits
get

Total number of bits in the representation (16).

Implements SystemEx.Numeric.IHalf< T >.

◆ Zero

Half16 SystemEx.Numeric.Half16.Zero
staticget

Represents +0.


The documentation for this struct was generated from the following file:
  • Half16.cs