Skip to main content
128-bit unsigned integer with overflow checking.
import * as Uint128 from 'voltaire-effect/Uint128'
import * as Schema from 'effect/Schema'
import { Effect } from 'effect'

// Schema
const value = Schema.decodeSync(Uint128.BigInt)(1000000000000n)

// Effect with arithmetic
const program = Effect.gen(function* () {
  const a = yield* Uint128.from(1000n)
  const b = yield* Uint128.from(500n)
  return yield* Uint128.plus(a, b) // 1500n
})

API

FunctionReturns
toBigInt(v)bigint
toNumber(v)number
toHex(v)hex string
equals(a, b)boolean

Constants

MAX, MIN, ZERO, ONE