Module
Data.Decimal
- Package
- purescript-decimals
- Repository
- sharkdp/purescript-decimals
This module defines a Decimal
data type for arbitrary precision numbers.
#fromString Source
fromString :: String -> Maybe Decimal
Parse a string into a Decimal
, assuming a decimal representation. Returns
Nothing
if the parse fails.
Examples:
fromString "42.001"
fromString "857981209301293808359384092830482"
fromString "1e100"
fromString "0.12301928309128183579487598149533"
#fromNumber Source
fromNumber :: Number -> Decimal
Convert a number to a Decimal.
#toPrecision Source
toPrecision :: Int -> Decimal -> String
A representation of the Decimal
as a String
, rounded to the given
number of significant digits
#toSignificantDigits Source
toSignificantDigits :: Int -> Decimal -> Decimal
Round to the given number of significant digits.
#acot Source
acot :: Decimal -> Decimal
Inverse cotangent.
Note that this is a multivalued function. The definition here refers to the principal value of 'acot' without a discontinuity at x=0, and a domain of (0, π). See https://mathworld.wolfram.com/InverseCotangent.html for more information.
- Modules
- Data.
Decimal