Module

Data.HugeNum

Package
purescript-precise
Repository
purescript-contrib/purescript-precise

#fromString Source

fromString :: String -> Maybe HugeNum

Create a HugeNum from a String. Strings should be in the form of a Purescript Number. For example, fromString "123.456" => Just (HugeNum 123.456)

#toNumber Source

toNumber :: HugeNum -> Number

Creates a HugeNum from a Number. May lose precision if the argument is too large.

#integerPart Source

integerPart :: HugeNum -> HugeNum

Returns the integer part of a HugeNum.

#fractionalPart Source

fractionalPart :: HugeNum -> HugeNum

Returns the fractional part of a HugeNum.

#numOfIntegral Source

numOfIntegral :: HugeNum -> Int

Counts how many digits are before the decimal.

#numOfFractional Source

numOfFractional :: HugeNum -> Int

Counts how many digits are after the decimal.

#abs Source

abs :: HugeNum -> HugeNum

Creates a nonnegative value with the same magnitude as the argument.

#neg Source

neg :: HugeNum -> HugeNum

Flips the sign. While negate from the Prelude does the same, this is faster.

#floor Source

floor :: HugeNum -> HugeNum

Returns the closest integer-valued HugeNum less than or equal to the argument.

#ceil Source

ceil :: HugeNum -> HugeNum

Returns the closest integer-valued HugeNum greater than or equal to the argument.

#round Source

round :: HugeNum -> HugeNum

Returns the closest integer-valued HugeNum to the argument.

#pow Source

pow :: HugeNum -> Int -> HugeNum

Raise a HugeNum to an integer power.

#(^) Source

Operator alias for Data.HugeNum.pow (right-associative / precedence 8)

#truncate Source

truncate :: Int -> HugeNum -> HugeNum

Limits the number of digits past the decimal.