2 % (c) The AQUA Project, Glasgow University, 1997-98
4 \section[Numeric]{Numeric interface}
6 Odds and ends, mostly functions for reading and showing
7 \tr{RealFloat}-like kind of values.
11 {-# OPTIONS -fno-implicit-prelude #-}
20 readDec, readOct, readHex,
41 %*********************************************************
43 \subsection[Numeric-signatures]{Signatures}
45 %*********************************************************
50 fromRat :: (RealFloat a) => Rational -> a
52 showSigned :: (Real a) => (a -> ShowS) -> Int -> a -> ShowS
53 readSigned :: (Real a) => ReadS a -> ReadS a
55 showInt :: Integral a => a -> ShowS
56 readInt :: (Integral a) => a -> (Char -> Bool) -> (Char -> Int) -> ReadS a
58 readDec :: (Integral a) => ReadS a
59 readOct :: (Integral a) => ReadS a
60 readHex :: (Integral a) => ReadS a
62 showEFloat :: (RealFloat a) => Maybe Int -> a -> ShowS
63 showFFloat :: (RealFloat a) => Maybe Int -> a -> ShowS
64 showGFloat :: (RealFloat a) => Maybe Int -> a -> ShowS
65 showFloat :: (RealFloat a) => a -> ShowS
67 readFloat :: (RealFloat a) => ReadS a
69 floatToDigits :: (RealFloat a) => Integer -> a -> ([Int], Int)
70 lexDigits :: ReadS String
74 showInt :: Integral a => a -> ShowS
76 = case quotRem n 10 of { (n', d) ->
77 case chr (ord_0 + fromIntegral d) of { C# c# -> -- stricter than necessary
81 if n' == 0 then r' else showInt n' r'
86 Controlling the format and precision of floats. The code that
87 implements the formatting itself is in @PrelNum@ to avoid
91 showEFloat :: (RealFloat a) => Maybe Int -> a -> ShowS
92 showFFloat :: (RealFloat a) => Maybe Int -> a -> ShowS
93 showGFloat :: (RealFloat a) => Maybe Int -> a -> ShowS
95 showEFloat d x = showString (formatRealFloat FFExponent d x)
96 showFFloat d x = showString (formatRealFloat FFFixed d x)
97 showGFloat d x = showString (formatRealFloat FFGeneric d x)