Module

Js.BigInt.BigInt

Package
purescript-js-bigints
Repository
sigma-andex/purescript-js-bigints

#and Source

and :: BigInt -> BigInt -> BigInt

and the bits.

#asIntN Source

asIntN :: Int -> BigInt -> BigInt

Clamps a BigInt value to the given number of bits, and returns that value as a signed integer.

#asUintN Source

asUintN :: Int -> BigInt -> BigInt

Clamps a BigInt value to the given number of bits, and returns that value as an unsigned integer.

#fromInt Source

fromInt :: Int -> BigInt

Convert an integer to a BigInt.

#fromNumber Source

fromNumber :: Number -> Maybe BigInt

Convert a Number to a BigInt. The fractional part is truncated.

#fromString Source

fromString :: String -> Maybe BigInt

Parse a string into a BigInt, assuming a decimal representation. Returns Nothing if the parse fails.

Examples:

fromString "42"
fromString "857981209301293808359384092830482"
fromString "1e100"

#fromTLInt Source

fromTLInt :: forall i sym. ToString i sym => Reflectable sym String => Proxy i -> BigInt

Converts a type-level integer into a BigInt:

import Type.Proxy (Proxy(..))
foo = fromTLInt (Proxy :: Proxy 857981209301293808359384092830482)

#not Source

not :: BigInt -> BigInt

Invert the bits.

#or Source

or :: BigInt -> BigInt -> BigInt

or the bits.

#shl Source

shl :: BigInt -> BigInt -> BigInt

shift the bits left and zero fill.

#shr Source

shr :: BigInt -> BigInt -> BigInt

Shift the bits right and maintain pos/neg.

#toString Source

toString :: BigInt -> String

A decimal representation of the BigInt as a String.

#xor Source

xor :: BigInt -> BigInt -> BigInt

Exlusive or the bits.