Module
Data.BigInt
- Package
- purescript-bigints
- Repository
- sharkdp/purescript-bigints
This module defines a BigInt
data type for arbitrary length integers.
#BaseDigits Source
type BaseDigits = { isNegative :: Boolean, value :: NonEmptyArray Int }
#fromNumber Source
fromNumber :: Number -> 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"
#toNonEmptyString Source
toNonEmptyString :: BigInt -> NonEmptyString
A decimal representation of the BigInt
as a NonEmptyString
.
#digitsInBase Source
digitsInBase :: Int -> BigInt -> BaseDigits
A base N representation of the BigInt
as an array of digits.
- Modules
- Data.
BigInt