JS.BigInt
- Package
- purescript-js-bigints
- Repository
- sigma-andex/purescript-js-bigints
#fromNumber Source
fromNumber :: Number -> Maybe BigIntConvert a Number to a BigInt. The fractional part is truncated.
#fromString Source
fromString :: String -> Maybe BigIntParse a string into a BigInt, assuming a decimal representation. Returns
Nothing if the parse fails.
Examples:
fromString "42"
fromString "857981209301293808359384092830482"
fromString "1e100"
Re-exports from Data.Int
#Radix Source
newtype RadixThe number of unique digits (including zero) used to represent integers in a specific base.
#Parity Source
data ParityA type for describing whether an integer is even or odd.
The Ord instance considers Even to be less than Odd.
The Semiring instance allows you to ask about the parity of the results
of arithmetical operations, given only the parities of the inputs. For
example, the sum of an odd number and an even number is odd, so
Odd + Even == Odd. This also works for multiplication, eg. the product
of two odd numbers is odd, and therefore Odd * Odd == Odd.
More generally, we have that
parity x + parity y == parity (x + y)
parity x * parity y == parity (x * y)
for any integers x, y. (A mathematician would say that parity is a
ring homomorphism.)
After defining addition and multiplication on Parity in this way, the
Semiring laws now force us to choose zero = Even and one = Odd.
This Semiring instance actually turns out to be a Field.
Constructors
Instances
#hexadecimal Source
hexadecimal :: RadixThe base-16 system.
- Modules
- JS.
BigInt