The NumExts
interface collect together various numeric
operations that have proven to be commonly useful
-- Going between Doubles and Floats:
doubleToFloat :: Double -> Float
floatToDouble :: Float -> Double
showHex :: Integral a => a -> ShowS
showOct :: Integral a => a -> ShowS
Notes:
doubleToFloat
is applied to a Double
that is within
the representable range for Float
, the result may be the next
higher or lower representable Float
value. If the Double
is out of range, the result is undefined.floatToDouble
, the floating value remains unchanged.showOct
and showHex
will prefix 0o
and 0x
respectively. Like Numeric.showInt
, these show functions
work on positive numbers only.