Safe Haskell | None |
---|
Pretty printing utils.
Documentation
module Text.PrettyPrint
pprEngDouble :: String -> Double -> Maybe DocSource
Pretty print an engineering value, to 4 significant figures. Valid range is 10^(-24) (y/yocto) to 10^(+24) (Y/Yotta). Out of range values yield Nothing.
examples:
liftM render $ pprEngDouble "J" 102400 ==> Just "1.024MJ" liftM render $ pprEngDouble "s" 0.0000123 ==> Just "12.30us"
pprEngInteger :: String -> Integer -> Maybe DocSource
Like pprEngDouble
but don't display fractional part when the value is < 1000.
Good for units where fractional values might not make sense (like bytes).