| Stability | experimental |
|---|---|
| Safe Haskell | None |
| Language | Haskell98 |
Data.SciRatio.Show
Description
The functions here pretty-print numbers in a compact format. Examples:
>>>showSciRational (-0.0e+3) -- result: "0">>>showSciRational (0.25e+2) -- result: "25">>>showSciRational (-1.0e-1) -- result: "-.1">>>showSciRational (5.0e+20 / 6) -- result: "2.5e20/3">>>showSciRational (0xfeedface) -- result: "4277009102">>>showSciRational (1 .^ 99999999) -- result: "1e99999999"
Note: Without taking optimizations into account, the specialized functions
( and showSciRational) are much more
efficient than the generic functions (showsSciRational and
showNumber respectively).showsNumber
- showNumber :: Real a => a -> String
- showSciRational :: SciRational -> String
- showsNumber :: Real a => a -> ShowS
- showsSciRational :: SciRational -> ShowS
Simple pretty-printers
showNumber :: Real a => a -> String Source
Show a number (see ).showsNumber
Note: for , consider using the more efficient, specialized
function SciRational instead.showSciRational
showSciRational :: SciRational -> String Source
Show a number (see ).showsNumber
ShowS pretty-printers
ShowSshowsNumber :: Real a => a -> ShowS Source
Show a rational number in scientific notation:
[-+]? ( [0-9]+ [.]? [0-9]* | [.] [0-9]+ ) ( [e] [-+]? [0-9]+ )? ( [/] [0-9]+ )?
Note: for , consider using the more efficient, specialized
function SciRational instead.showsSciRational
showsSciRational :: SciRational -> ShowS Source
Show a number (see ).showNumber