DecimalFixedPoint

type DecimalFixedPoint<TSignedness, TTotalBits, TDecimals> = object;

A fixed-point number whose scale is a power of 10. The stored raw bigint represents the mathematical value raw / 10 ** decimals.

Decimal fixed-point is the natural representation for quantities that users reason about in base-10 terms, such as token amounts, currency, or probabilities with decimal precision.

Example

An unsigned 64-bit USDC amount with 6 decimals of precision:

type Usdc = DecimalFixedPoint<'unsigned', 64, 6>;

See

Type Parameters

Type ParameterDescription
TSignedness extends SignednessWhether the value can be negative.
TTotalBits extends numberThe total number of bits used to store the raw value.
TDecimals extends numberThe number of decimal digits to the right of the decimal point.

Properties

decimals

readonly decimals: TDecimals;

kind

readonly kind: "decimalFixedPoint";

raw

readonly raw: bigint;

signedness

readonly signedness: TSignedness;

totalBits

readonly totalBits: TTotalBits;

On this page