Numeric.Compat

base-compat-0.14.1: A compatibility layer for base

Safe Haskell | Safe-Inferred
Language | Haskell2010

Numeric.Compat

Synopsis

- module Numeric
- showBin :: Integral a => a -> ShowS
- showFFloatAlt :: RealFloat a => Maybe Int -> a -> ShowS
- showGFloatAlt :: RealFloat a => Maybe Int -> a -> ShowS
- showHFloat :: RealFloat a => a -> ShowS
- readBin :: (Eq a, Num a) => ReadS a

# Documentation

module Numeric

showBin :: Integral a => a -> ShowS #

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"

@since base-4.11.0.0

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

Read an unsigned number in binary notation.

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