TorchLean API

FloatLib.Floats.Formats.DecimalInterchange.Conversion.Posit.Runtime

Numeric conversion between posits and decimal interchange #

Both directions decode the source exactly and round once to the destination. Posit-to-decimal conversion uses the requested decimal rounding direction and prefers quantum zero on an exact result. This preferred quantum is the library's nondecimal-conversion policy; the Posit Standard does not prescribe decimal cohorts. For an exact result, projection chooses the quantum closest to zero among that result's representable cohort members, including when the layout excludes quantum zero.

Posit zero becomes positive decimal zero. NaR becomes a quiet decimal NaN with zero payload and clear status. In the other direction, decimal NaNs and either infinity become NaR, either signed zero becomes posit zero, and finite values use the standard appended-bit posit rounding rule.

References #

Convert an arbitrary-width posit to decimal, preferring quantum zero. NaR maps to a quiet zero-payload NaN without raising invalid.

Instances For

    Convert a decimal datum to an arbitrary-width posit. Finite values are rounded once by the Posit Standard rule; all decimal nonfinite values become NaR.

    Instances For