#mizchi/js/builtins/bigint

    Arbitrary-precision integers with JavaScript's BigInt.

    #Installation

    Add to your moon.pkg.json:

    { "import": [ "mizchi/js", "mizchi/js/builtins/bigint" ] }

    #Overview

    Provides bindings for JavaScript's BigInt for working with arbitrarily large integers.

    #Usage Example

    fn main {
    // Create BigInt from string
    let big = @bigint.JsBigInt::from_string("9007199254740991")

    // Create from Int64
    let big2 = @bigint.JsBigInt::from_int64(123L)

    // Convert to string
    let str = big.to_string()

    // Note: Use JavaScript operators via FFI for arithmetic
    }

    #Reference

    JsBigInt

    #external
    pub type JsBigInt

    JsBigInt::add

    fn JsBigInt::add(a : JsBigInt, b : JsBigInt) -> JsBigInt

    JS: a + b

    JsBigInt::asIntN

    fn JsBigInt::asIntN(bits : Int, bigint : JsBigInt) -> JsBigInt

    JS: BigInt.asIntN(bits, bigint)

    JsBigInt::asUintN

    fn JsBigInt::asUintN(bits : Int, bigint : JsBigInt) -> JsBigInt

    JS: BigInt.asUintN(bits, bigint)

    JsBigInt::as_any

    JsBigInt::bitand

    fn JsBigInt::bitand(a : JsBigInt, b : JsBigInt) -> JsBigInt

    JS: a & b

    JsBigInt::bitnot

    fn JsBigInt::bitnot(a : JsBigInt) -> JsBigInt

    JS: ~a

    JsBigInt::bitor

    fn JsBigInt::bitor(a : JsBigInt, b : JsBigInt) -> JsBigInt

    JS: a | b

    JsBigInt::bitxor

    fn JsBigInt::bitxor(a : JsBigInt, b : JsBigInt) -> JsBigInt

    JS: a ^ b

    JsBigInt::div

    fn JsBigInt::div(a : JsBigInt, b : JsBigInt) -> JsBigInt

    JS: a / b

    JsBigInt::equal

    fn JsBigInt::equal(a : JsBigInt, b : JsBigInt) -> Bool

    JS: a == b

    JsBigInt::from_int

    fn JsBigInt::from_int(value : Int) -> JsBigInt

    JS: BigInt(value)

    JsBigInt::from_string

    fn JsBigInt::from_string(value : String) -> JsBigInt

    JS: BigInt(value)

    JsBigInt::ge

    fn JsBigInt::ge(a : JsBigInt, b : JsBigInt) -> Bool

    JS: a >= b

    JsBigInt::gt

    fn JsBigInt::gt(a : JsBigInt, b : JsBigInt) -> Bool

    JS: a > b

    JsBigInt::le

    fn JsBigInt::le(a : JsBigInt, b : JsBigInt) -> Bool

    JS: a <= b

    JsBigInt::lt

    fn JsBigInt::lt(a : JsBigInt, b : JsBigInt) -> Bool

    JS: a < b

    JsBigInt::mod

    fn JsBigInt::mod(a : JsBigInt, b : JsBigInt) -> JsBigInt

    JS: a % b

    JsBigInt::mul

    fn JsBigInt::mul(a : JsBigInt, b : JsBigInt) -> JsBigInt

    JS: a * b

    JsBigInt::neg

    fn JsBigInt::neg(a : JsBigInt) -> JsBigInt

    JS: -a

    JsBigInt::pow

    fn JsBigInt::pow(a : JsBigInt, b : JsBigInt) -> JsBigInt

    JS: a ** b

    JsBigInt::shl

    fn JsBigInt::shl(a : JsBigInt, b : JsBigInt) -> JsBigInt

    JS: a << b

    JsBigInt::shr

    fn JsBigInt::shr(a : JsBigInt, b : JsBigInt) -> JsBigInt

    JS: a >> b

    JsBigInt::sub

    fn JsBigInt::sub(a : JsBigInt, b : JsBigInt) -> JsBigInt

    JS: a - b

    JsBigInt::to_string

    fn JsBigInt::to_string(self : JsBigInt) -> String

    JS: bigint.toString()

    JsBigInt::to_string_radix

    fn JsBigInt::to_string_radix(self : JsBigInt, radix : Int) -> String

    JS: bigint.toString(radix)

    JsBigInt::valueOf

    fn JsBigInt::valueOf(self : JsBigInt) -> JsBigInt

    JS: bigint.valueOf()

    Source Files