Skip to content

fixedSIntBigFrom

fixedSIntBigFrom(value, bitWidth, mode?): bigint

Defined in: packages/math-numbers/src/fixed-int-big/fixed-sint-big-from.ts:31

Brings an arbitrary bigint into a bitWidth-bit two’s-complement integer under mode.

Every signed operation in this directory ends here: each one computes its exact bigint result, which cannot overflow, and hands it over to be fitted. That is what keeps the overflow policy in one place instead of once per operation.

mode is read from numericConfig when omitted, and read on each call rather than captured, so changing the global takes effect immediately. One default at every width, deliberately: a policy that changed at 64 bits would make the same expression mean different things depending on the type it was written for.

bigint

The exact value to fit.

number

Width of the integer, in bits.

OverflowMode = numericConfig.defaultOverflowMode

Overflow policy. Defaults to numericConfig.defaultOverflowMode.

bigint

value itself when it already fits, and otherwise the wrapped, clamped or (for abort) never-returned result.

When bitWidth is not a non-negative safe integer.

When value does not fit and mode is abort.