[project @ 1998-12-02 13:17:09 by simonm]
[ghc-hetmet.git] / ghc / docs / libraries / NumExts.sgml
1 <sect> <idx/NumExts/
2 <label id="sec:NumExts">
3 <p>
4
5 The <tt/NumExts/ interface collect together various numeric
6 operations that have proven to be commonly useful 
7
8 <tscreen> <verb>
9 -- Going between Doubles and Floats:
10 doubleToFloat :: Double -> Float
11 floatToDouble :: Float  -> Double
12
13 showHex       :: Integral a => a -> ShowS
14 showOct       :: Integral a => a -> ShowS
15 </verb> </tscreen>
16
17 Notes: 
18 <itemize>
19 <item>
20     If <tt/doubleToFloat/ is applied to a <tt/Double/ that is within
21     the representable range for <tt/Float/, the result may be the next
22     higher or lower representable <tt/Float/ value. If the <tt/Double/
23     is out of range, the result is undefined.
24 <item>
25     No loss of precision occurs in the other direction with
26     <tt/floatToDouble/, the floating value remains unchanged.
27 <item>
28     <tt/showOct/ and <tt/showHex/ will prefix <tt/0o/ and <tt/0x/
29     respectively. Like <tt/Numeric.showInt/, these show functions
30     work on positive numbers only.
31 </itemize>