Skip to content

Version 12.1.0

Latest
Compare
Choose a tag to compare
@MrMatthewLayton MrMatthewLayton released this 22 Apr 23:57
· 1 commit to main since this release

ONIXLabs DotNET Library 12.1.0

We are excited to announce the release of ONIXLabs .NET Library version 12.1.0, now available on NuGet.

Numerics Updates

Decimal.SetScale

A new extension method for System.Decimal has been added: SetScale(int) and SetScale(int, MidpointRounding), for controlling the scale (decimal places) of decimal values, and consists of the following behavior:

  • Pads the decimal value with trailing zeroes if scale is too low.
  • Truncates safely if no precision is lost.
  • Throws if truncation would discard non-zero digits, or rounds using the specified MidpointRounding mode.

GenericMath.Pow10

A new method under the generic math class provides utility for computing powers of 10 for any numeric type implementing INumber<T> (e.g. int, long, decimal, double, etc.) using an efficient implementation using exponentiation by squaring (O(log n)).

  • Typed safely with INumber
  • Throws for negative exponents (by design)