qrisp.BigInteger.create#

static BigInteger.create(n, size) → BigInteger#

Create a BigInteger using JAX primitives.

Constructs a fixed-width BigInteger with exactly size limbs, interpreting the input modulo 2^(32*size). JIT-friendly.

Parameters:
nint or float or jnp.integer or jnp.floating

Non-negative number. Floats are truncated; very large floats (> 2**53) may lose precision before conversion.

sizeint

Number of limbs (digits) to allocate.

Returns:
BigInteger

Fixed-width representation of n modulo 2^(32*size).

Notes

When called with a Python literal outside jit, the value must fit into JAX’s host integer range (typically up to 64 bits). For arbitrarily large Python integers, prefer create_static.

Examples

>>> a = BigInteger.create(123456789, 4)
>>> a()
123456789
>>> (a + BigInteger.create(1, 4))()
123456790