FixedBinary.fromString

Result!(FixedBinary, FixedBinaryError) fromString(scope const(char)[] text, RoundingMode mode = RoundingMode.NEAREST_EVEN) static @safe pure nothrow @nogc

Parses decimal text, rounding to the nearest representable value per mode. Grammar: optional `+`/`-`, digits with at most one `.`, at least one digit overall; no exponents, no grouping, ASCII digits only — the same grammar as FixedDecimal.fromString. Decimals that are not exactly representable in binary (such as 0.1) are rounded, not rejected. At most scale + 1 fractional decimal digits are retained, enough to represent every half-quantum boundary exactly. A nonzero tail beyond that distinguishes an exact tie from a value just above it. No floating-point intermediary is used.

Parameters

textthe decimal literal.
modehow sub-quantum remainders round.

Returns

The parsed value, or FixedBinaryError with INVALID_INPUT for

malformed text and OUT_OF_RANGE for values exceeding the storage range.