binaryFixedPointToBase10
Converts a BinaryFixedPoint to its exact base-10 representation
as a (raw, decimals) pair such that the mathematical value equals
raw / 10 ** decimals.
Because 1 / 2 ** F has a finite decimal expansion of exactly F
digits, the conversion is always lossless:
raw / 2 ** F === (raw * 5 ** F) / 10 ** F. The transformed raw
therefore carries exactly fractionalBits decimal digits of
precision.
Useful when you want to feed a binary fixed-point into a tool that
understands base-10 scaled integers (such as Intl.NumberFormat's
string scientific notation).
Parameters
| Parameter | Type |
|---|---|
value | BinaryFixedPoint<Signedness, number, number> |
Returns
object
| Name | Type |
|---|---|
decimals | number |
raw | bigint |