base-compat-0.12.0: A compatibility layer for base
Safe HaskellSafe-Inferred
LanguageHaskell2010

Numeric.Compat

Synopsis

Documentation

module Numeric

showBin :: (Integral a, Show a) => a -> ShowS Source #

Show non-negative Integral numbers in base 2.

showFFloatAlt :: RealFloat a => Maybe Int -> a -> ShowS #

Show a signed RealFloat value using standard decimal notation (e.g. 245000, 0.0015).

This behaves as showFFloat, except that a decimal point is always guaranteed, even if not needed.

Since: base-4.7.0.0

showGFloatAlt :: RealFloat a => Maybe Int -> a -> ShowS #

Show a signed RealFloat value using standard decimal notation for arguments whose absolute value lies between 0.1 and 9,999,999, and scientific notation otherwise.

This behaves as showFFloat, except that a decimal point is always guaranteed, even if not needed.

Since: base-4.7.0.0

showHFloat :: RealFloat a => a -> ShowS #

Show a floating-point value in the hexadecimal format, similar to the %a specifier in C's printf.

>>> showHFloat (212.21 :: Double) ""
"0x1.a86b851eb851fp7"
>>> showHFloat (-12.76 :: Float) ""
"-0x1.9851ecp3"
>>> showHFloat (-0 :: Double) ""
"-0x0p+0"

readBin :: (Eq a, Num a) => ReadS a Source #

Read an unsigned number in binary notation.

>>> readBin "10011"
[(19,"")]