Returns a fresh wrapper holding the same value.
Value types are cheap to copy. Ordinary setters already borrow/clone wrapper inputs; this method is a convenience when an explicit second wrapper object is useful.
Divides by a number | bigint scalar.
Throws ParamError on division by zero, overflow, or an invalid
scalar.
Returns true when the value is exactly zero.
Computes the remainder against a number | bigint scalar.
Throws ParamError on division by zero, overflow, or an invalid
scalar.
Multiplies by a number | bigint scalar.
bigint is exact; number is imprecise.
Throws ParamError on overflow or an invalid scalar.
Returns the canonical decimal string for JSON serialization.
Converts this quantity into an unsigned position size.
Returns the canonical decimal string.
StaticfromConstructs from a JS number (imprecise; prefer fromString).
Throws ParamError on a non-finite or out-of-domain value.
StaticfromConstructs from a JS number then quantizes to scale.
WARNING: the float source is imprecise; prefer
fromStringRounded.
Throws ParamError on an invalid value, scale, or strategy.
StaticfromStaticfromConstructs losslessly from a decimal string.
Throws ParamError on an invalid format or out-of-domain value.
StaticfromParses a decimal string then quantizes to scale using
strategy.
Throws ParamError on an invalid value, scale, or strategy.
StaticzeroReturns the zero value.
Constructs from a
DecimalInput(string | number | bigint).A generic
numbermust be a safe integer. UsefromFloatexplicitly for imprecise fractional input.Errors
Throws
ParamErroron an invalid value or type.