toBinary

fnResult!(FixedBinary!(I, Bits), FixedBinaryError) toBinary(I, int Bits, S, int Sc)( FixedDecimal!(S, Sc) value, RoundingMode mode = RoundingMode.NEAREST_EVEN) @safe pure

Converts a decimal fixed-point value to the binary family, rounding per mode (exact rational conversion: the decimal text is exact, the binary parse rounds at the target quantum). Not @nogc (string construction). FixedDecimal itself is unchanged — this is a free function.

Parameters

Ibinary storage type.
Bitsbinary fraction-bit count.
valuethe decimal value.
modehow sub-quantum remainders round.

Returns

The converted value, or FixedBinaryError with OUT_OF_RANGE when

it does not fit the target.