rescaleBinaryFixedPoint
Returns a BinaryFixedPoint with the same signedness as value
but a new totalBits and fractionalBits. If the requested shape
matches the input shape, the same reference is returned.
Scale-up (higher fractionalBits) is always exact. Scale-down (lower
fractionalBits) is potentially lossy; the optional RoundingMode
is consulted on inexact results and defaults to 'strict', which throws
SOLANA_ERROR__FIXED_POINTS__STRICT_MODE_PRECISION_LOSS.
Throws SOLANA_ERROR__FIXED_POINTS__ARITHMETIC_OVERFLOW when the
rescaled raw value does not fit the new totalBits.
Type Parameters
| Type Parameter |
|---|
TSignedness extends Signedness |
TNewTotalBits extends number |
TNewFractionalBits extends number |
Parameters
| Parameter | Type |
|---|---|
value | BinaryFixedPoint<TSignedness, number, number> |
newTotalBits | TNewTotalBits |
newFractionalBits | TNewFractionalBits |
rounding? | RoundingMode |
Returns
BinaryFixedPoint<TSignedness, TNewTotalBits, TNewFractionalBits>