FixedPointToStringOptions

type FixedPointToStringOptions = object;

Options accepted by binaryFixedPointToString and decimalFixedPointToString to control the emitted representation.

  • decimals: caps the number of fractional digits in the output. When this is lower than the value's native precision the raw value is rescaled using rounding (defaults to 'strict', which throws SOLANA_ERROR__FIXED_POINTS__STRICT_MODE_PRECISION_LOSS on inexact results). When higher, the extra precision is zero-padded only if padTrailingZeros is also set.
  • padTrailingZeros: emits exactly as many fractional digits as requested by decimals. When decimals is omitted, pads to the value's native scale (decimals for decimal values, fractionalBits for binary values — the length of the exact base-10 expansion). Defaults to false, which trims trailing zeros (and drops the decimal point altogether for whole numbers).
  • rounding: only consulted when decimals forces a scale-down. Defaults to 'strict'.

Properties

decimals?

optional decimals: number;

padTrailingZeros?

optional padTrailingZeros: boolean;

rounding?

optional rounding: RoundingMode;

On this page