Other

What's New in .NET 11 Numerics: Decimal32/64/128, BFloat16 and Complex<T>

NDepend Blog NDepend
Other

.NET 11 adds three IEEE 754 decimal types (Decimal32, Decimal64, Decimal128), a BFloat16 format for AI workloads, a generic Complex<T> and generic random APIs. System.Numerics.Tensors 11.0 also gets faster and stricter about overlapping buffers and NaN handling.

Key points

  • Decimal32/64/128 offer 7, 16 and 34 significant digits; 128-bit Decimal128 beats System.Decimal in precision.
  • The new decimal types support Infinity, NaN and signed zero, and division by zero no longer throws.
  • HaveSameQuantum(), GetQuantum() and Quantize() let you inspect and round on a value's quantum, e.g. prices to the cent.
  • BFloat16 keeps float's 8 exponent bits in 16 bits, so 100_000 survives where Half overflows to Infinity.
  • Complex<T> works for any IFloatingPointIeee754<T> type and implements INumberBase<Complex<T>> for generic math.
  • Random.NextInteger<T> and NextBinaryFloat<T> produce random values for UInt128, BigInteger and Half.
  • TryParsePartial parses the number at the start of a string and reports how many characters it consumed.
  • System.Numerics.Tensors 11.0 ships on NuGet with layout-aware fast paths plus overlapping-buffer and NaN fixes.

Real-world use

  • Storing large sensor arrays with Decimal32 where 7 digits of precision are enough
  • Rounding prices to the cent with Quantize() and built-in banker's rounding
  • Packing neural network weights as BFloat16 to halve memory and bandwidth while keeping float's range
  • Reusing a single generic polynomial evaluator over double, Decimal64, BFloat16 and Complex<float>

This summary was generated by the agent from the original post on NDepend Blog. The full text and all rights belong to its author and publisher. Go to original

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message