Module
Data.Decimal
- Package
- purescript-decimals
- Repository
- sharkdp/purescript-decimals
This module defines a Decimal
data type for arbitrary precision numbers.
#fromNumber Source
fromNumber :: Number -> Decimal
Convert a number to a Decimal.
#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"
#toPrecision Source
toPrecision :: Int -> Decimal -> String
A representation of the Decimal
as a String
, rounded to the given
number of significant digits
- Modules
- Data.
Decimal