ratioDecimalFixedPoint
Returns a factory that constructs DecimalFixedPoint values from
a rational numerator / denominator.
The outer call validates the shape parameters once and the returned factory can be called many times to construct values of that shape.
If the ratio cannot be exactly represented at the target decimals,
the returned factory throws
SOLANA_ERROR__FIXED_POINTS__STRICT_MODE_PRECISION_LOSS under the
default 'strict' rounding mode. Pass a different RoundingMode
to allow a rounded result. Zero denominators always throw
SOLANA_ERROR__FIXED_POINTS__INVALID_ZERO_DENOMINATOR_RATIO.
Type Parameters
| Type Parameter |
|---|
TSignedness extends Signedness |
TTotalBits extends number |
TDecimals extends number |
Parameters
| Parameter | Type |
|---|---|
signedness | TSignedness |
totalBits | TTotalBits |
decimals | TDecimals |
Returns
Parameters
| Parameter | Type |
|---|---|
numerator | bigint |
denominator | bigint |
rounding? | RoundingMode |
Returns
DecimalFixedPoint<TSignedness, TTotalBits, TDecimals>