summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib/Numeric
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/lib/Numeric')
-rw-r--r--testsuite/tests/lib/Numeric/Makefile3
-rw-r--r--testsuite/tests/lib/Numeric/all.T10
-rw-r--r--testsuite/tests/lib/Numeric/num001.hs6
-rw-r--r--testsuite/tests/lib/Numeric/num001.stdout1
-rw-r--r--testsuite/tests/lib/Numeric/num002.hs20
-rw-r--r--testsuite/tests/lib/Numeric/num002.stdout6
-rw-r--r--testsuite/tests/lib/Numeric/num002.stdout-alpha-dec-osf36
-rw-r--r--testsuite/tests/lib/Numeric/num002.stdout-mips-sgi-irix6
-rw-r--r--testsuite/tests/lib/Numeric/num002.stdout-ws-646
-rw-r--r--testsuite/tests/lib/Numeric/num002.stdout-x86_64-unknown-openbsd6
-rw-r--r--testsuite/tests/lib/Numeric/num003.hs20
-rw-r--r--testsuite/tests/lib/Numeric/num003.stdout6
-rw-r--r--testsuite/tests/lib/Numeric/num003.stdout-alpha-dec-osf36
-rw-r--r--testsuite/tests/lib/Numeric/num003.stdout-mips-sgi-irix6
-rw-r--r--testsuite/tests/lib/Numeric/num003.stdout-ws-646
-rw-r--r--testsuite/tests/lib/Numeric/num003.stdout-x86_64-unknown-openbsd6
-rw-r--r--testsuite/tests/lib/Numeric/num004.hs20
-rw-r--r--testsuite/tests/lib/Numeric/num004.stdout6
-rw-r--r--testsuite/tests/lib/Numeric/num004.stdout-alpha-dec-osf36
-rw-r--r--testsuite/tests/lib/Numeric/num004.stdout-mips-sgi-irix6
-rw-r--r--testsuite/tests/lib/Numeric/num004.stdout-ws-646
-rw-r--r--testsuite/tests/lib/Numeric/num004.stdout-x86_64-unknown-openbsd6
-rw-r--r--testsuite/tests/lib/Numeric/num005.hs23
-rw-r--r--testsuite/tests/lib/Numeric/num005.stdout55
-rw-r--r--testsuite/tests/lib/Numeric/num005.stdout-alpha-dec-osf355
-rw-r--r--testsuite/tests/lib/Numeric/num005.stdout-mips-sgi-irix55
-rw-r--r--testsuite/tests/lib/Numeric/num005.stdout-ws-6455
-rw-r--r--testsuite/tests/lib/Numeric/num005.stdout-x86_64-unknown-openbsd55
-rw-r--r--testsuite/tests/lib/Numeric/num006.hs28
-rw-r--r--testsuite/tests/lib/Numeric/num006.stdout6
-rw-r--r--testsuite/tests/lib/Numeric/num007.hs17
-rw-r--r--testsuite/tests/lib/Numeric/num007.stdout9
-rw-r--r--testsuite/tests/lib/Numeric/num008.hs57
-rw-r--r--testsuite/tests/lib/Numeric/num008.stdout148
-rw-r--r--testsuite/tests/lib/Numeric/num009.hs39
-rw-r--r--testsuite/tests/lib/Numeric/num009.stdout1
-rw-r--r--testsuite/tests/lib/Numeric/num010.hs29
-rw-r--r--testsuite/tests/lib/Numeric/num010.stdout189
38 files changed, 991 insertions, 0 deletions
diff --git a/testsuite/tests/lib/Numeric/Makefile b/testsuite/tests/lib/Numeric/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/Numeric/all.T b/testsuite/tests/lib/Numeric/all.T
new file mode 100644
index 0000000000..d6237fbee8
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/all.T
@@ -0,0 +1,10 @@
+test('num001', normal, compile_and_run, [''])
+test('num002', normal, compile_and_run, [''])
+test('num003', normal, compile_and_run, [''])
+test('num004', normal, compile_and_run, [''])
+test('num005', normal, compile_and_run, [''])
+test('num006', normal, compile_and_run, [''])
+test('num007', normal, compile_and_run, [''])
+test('num008', normal, compile_and_run, [''])
+test('num009', compose(skip_if_fast, if_os('darwin', expect_broken(2370))), compile_and_run, [''])
+test('num010', normal, compile_and_run, [''])
diff --git a/testsuite/tests/lib/Numeric/num001.hs b/testsuite/tests/lib/Numeric/num001.hs
new file mode 100644
index 0000000000..8a8c97a11b
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num001.hs
@@ -0,0 +1,6 @@
+module Main(main) where
+
+import Numeric
+import Data.Ratio
+
+main = print ((fromRat (132874 % 23849))::Double)
diff --git a/testsuite/tests/lib/Numeric/num001.stdout b/testsuite/tests/lib/Numeric/num001.stdout
new file mode 100644
index 0000000000..6d2f0c7a77
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num001.stdout
@@ -0,0 +1 @@
+5.571470501907837
diff --git a/testsuite/tests/lib/Numeric/num002.hs b/testsuite/tests/lib/Numeric/num002.hs
new file mode 100644
index 0000000000..31ea76ced9
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num002.hs
@@ -0,0 +1,20 @@
+-- Testing showInt, lightly.
+
+module Main(main) where
+
+import Numeric
+
+showSignedInt :: Integral a => a -> String
+showSignedInt x = showSigned (showInt) 0 x ""
+
+main =
+ do
+ putStrLn (showInt (343023920121::Integer) [])
+ putStrLn (showInt (3430239::Int) [])
+ putStrLn (showInt (1212 :: Int) [])
+ putStrLn (showSignedInt (591125662431 `div` (517::Int)))
+ -- showInt just works over naturals, wrap it up inside
+ -- a use of Numeric.showSigned to show negative nums.
+ putStrLn (showSignedInt (-111::Int))
+ putStrLn (showInt (232189458241::Integer) [])
+
diff --git a/testsuite/tests/lib/Numeric/num002.stdout b/testsuite/tests/lib/Numeric/num002.stdout
new file mode 100644
index 0000000000..ce14dec313
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num002.stdout
@@ -0,0 +1,6 @@
+343023920121
+3430239
+1212
+-3055754
+-111
+232189458241
diff --git a/testsuite/tests/lib/Numeric/num002.stdout-alpha-dec-osf3 b/testsuite/tests/lib/Numeric/num002.stdout-alpha-dec-osf3
new file mode 100644
index 0000000000..b81876f763
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num002.stdout-alpha-dec-osf3
@@ -0,0 +1,6 @@
+343023920121
+3430239
+1212
+1143376523
+-111
+232189458241
diff --git a/testsuite/tests/lib/Numeric/num002.stdout-mips-sgi-irix b/testsuite/tests/lib/Numeric/num002.stdout-mips-sgi-irix
new file mode 100644
index 0000000000..b81876f763
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num002.stdout-mips-sgi-irix
@@ -0,0 +1,6 @@
+343023920121
+3430239
+1212
+1143376523
+-111
+232189458241
diff --git a/testsuite/tests/lib/Numeric/num002.stdout-ws-64 b/testsuite/tests/lib/Numeric/num002.stdout-ws-64
new file mode 100644
index 0000000000..b81876f763
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num002.stdout-ws-64
@@ -0,0 +1,6 @@
+343023920121
+3430239
+1212
+1143376523
+-111
+232189458241
diff --git a/testsuite/tests/lib/Numeric/num002.stdout-x86_64-unknown-openbsd b/testsuite/tests/lib/Numeric/num002.stdout-x86_64-unknown-openbsd
new file mode 100644
index 0000000000..b81876f763
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num002.stdout-x86_64-unknown-openbsd
@@ -0,0 +1,6 @@
+343023920121
+3430239
+1212
+1143376523
+-111
+232189458241
diff --git a/testsuite/tests/lib/Numeric/num003.hs b/testsuite/tests/lib/Numeric/num003.hs
new file mode 100644
index 0000000000..368be2599a
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num003.hs
@@ -0,0 +1,20 @@
+-- Testing readInt, lightly.
+--
+module Main(main) where
+
+import Numeric
+import Data.Char
+
+main =
+ let
+ rd :: ReadS Integer
+ rd = readSigned (readInt 10 (isDigit) (digitToInt))
+ in
+ do
+ print (rd (show (343023920121::Integer)))
+ print (rd (show (3430239::Int)))
+ print (rd (show (1212 :: Int)))
+ print (rd (show (591125662431 `div` (517::Int))))
+ print (rd (show (-111::Int)))
+ print (rd (show (232189458241::Integer)))
+
diff --git a/testsuite/tests/lib/Numeric/num003.stdout b/testsuite/tests/lib/Numeric/num003.stdout
new file mode 100644
index 0000000000..1266b608b3
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num003.stdout
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(1212,"")]
+[(-3055754,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/testsuite/tests/lib/Numeric/num003.stdout-alpha-dec-osf3 b/testsuite/tests/lib/Numeric/num003.stdout-alpha-dec-osf3
new file mode 100644
index 0000000000..ae95d2aa0a
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num003.stdout-alpha-dec-osf3
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(1212,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/testsuite/tests/lib/Numeric/num003.stdout-mips-sgi-irix b/testsuite/tests/lib/Numeric/num003.stdout-mips-sgi-irix
new file mode 100644
index 0000000000..ae95d2aa0a
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num003.stdout-mips-sgi-irix
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(1212,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/testsuite/tests/lib/Numeric/num003.stdout-ws-64 b/testsuite/tests/lib/Numeric/num003.stdout-ws-64
new file mode 100644
index 0000000000..ae95d2aa0a
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num003.stdout-ws-64
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(1212,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/testsuite/tests/lib/Numeric/num003.stdout-x86_64-unknown-openbsd b/testsuite/tests/lib/Numeric/num003.stdout-x86_64-unknown-openbsd
new file mode 100644
index 0000000000..ae95d2aa0a
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num003.stdout-x86_64-unknown-openbsd
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(1212,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/testsuite/tests/lib/Numeric/num004.hs b/testsuite/tests/lib/Numeric/num004.hs
new file mode 100644
index 0000000000..0eb2bee5b0
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num004.hs
@@ -0,0 +1,20 @@
+-- Exercising Numeric.readSigned a bit
+--
+module Main(main) where
+
+import Numeric
+import Data.Char
+
+main =
+ let
+ rd :: ReadS Integer
+ rd = readSigned (readInt 10 (isDigit) (digitToInt))
+ in
+ do
+ print (rd (show (343023920121::Integer)))
+ print (rd (show (3430239::Int)))
+ print (rd (show (-0 :: Int)))
+ print (rd (show (591125662431 `div` (517::Int))))
+ print (rd (show (-111::Int)))
+ print (rd (show (232189458241::Integer)))
+
diff --git a/testsuite/tests/lib/Numeric/num004.stdout b/testsuite/tests/lib/Numeric/num004.stdout
new file mode 100644
index 0000000000..12610a153d
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num004.stdout
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(0,"")]
+[(-3055754,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/testsuite/tests/lib/Numeric/num004.stdout-alpha-dec-osf3 b/testsuite/tests/lib/Numeric/num004.stdout-alpha-dec-osf3
new file mode 100644
index 0000000000..150f98e1ea
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num004.stdout-alpha-dec-osf3
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(0,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/testsuite/tests/lib/Numeric/num004.stdout-mips-sgi-irix b/testsuite/tests/lib/Numeric/num004.stdout-mips-sgi-irix
new file mode 100644
index 0000000000..150f98e1ea
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num004.stdout-mips-sgi-irix
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(0,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/testsuite/tests/lib/Numeric/num004.stdout-ws-64 b/testsuite/tests/lib/Numeric/num004.stdout-ws-64
new file mode 100644
index 0000000000..150f98e1ea
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num004.stdout-ws-64
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(0,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/testsuite/tests/lib/Numeric/num004.stdout-x86_64-unknown-openbsd b/testsuite/tests/lib/Numeric/num004.stdout-x86_64-unknown-openbsd
new file mode 100644
index 0000000000..150f98e1ea
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num004.stdout-x86_64-unknown-openbsd
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(0,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/testsuite/tests/lib/Numeric/num005.hs b/testsuite/tests/lib/Numeric/num005.hs
new file mode 100644
index 0000000000..ef647a6967
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num005.hs
@@ -0,0 +1,23 @@
+-- Exercising Numeric.readSigned a bit
+--
+module Main(main) where
+
+import Numeric
+
+main =
+ let
+ ls = ["3489348394032498320438240938403","0","-1","1","34323","2L","012","0x23","3243ab"]
+ present str f ls =
+ sequence (map (\ v -> putStr ('\n':str ++
+ ' ': v ++
+ " = " ++
+ (show (f v)))) ls)
+ in
+ do
+ present "(readDec::ReadS Integer)" (readDec::ReadS Integer) ls
+ present "(readDec::ReadS Int)" (readDec::ReadS Int) ls
+ present "(readOct::ReadS Integer)" (readOct::ReadS Integer) ls
+ present "(readOct::ReadS Int)" (readOct::ReadS Int) ls
+ present "(readHex::ReadS Integer)" (readHex::ReadS Integer) ls
+ present "(readHex::ReadS Int)" (readHex::ReadS Int) ls
+ putStrLn ""
diff --git a/testsuite/tests/lib/Numeric/num005.stdout b/testsuite/tests/lib/Numeric/num005.stdout
new file mode 100644
index 0000000000..f6ba218eb8
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num005.stdout
@@ -0,0 +1,55 @@
+
+(readDec::ReadS Integer) 3489348394032498320438240938403 = [(3489348394032498320438240938403,"")]
+(readDec::ReadS Integer) 0 = [(0,"")]
+(readDec::ReadS Integer) -1 = []
+(readDec::ReadS Integer) 1 = [(1,"")]
+(readDec::ReadS Integer) 34323 = [(34323,"")]
+(readDec::ReadS Integer) 2L = [(2,"L")]
+(readDec::ReadS Integer) 012 = [(12,"")]
+(readDec::ReadS Integer) 0x23 = [(0,"x23")]
+(readDec::ReadS Integer) 3243ab = [(3243,"ab")]
+(readDec::ReadS Int) 3489348394032498320438240938403 = [(-1268053597,"")]
+(readDec::ReadS Int) 0 = [(0,"")]
+(readDec::ReadS Int) -1 = []
+(readDec::ReadS Int) 1 = [(1,"")]
+(readDec::ReadS Int) 34323 = [(34323,"")]
+(readDec::ReadS Int) 2L = [(2,"L")]
+(readDec::ReadS Int) 012 = [(12,"")]
+(readDec::ReadS Int) 0x23 = [(0,"x23")]
+(readDec::ReadS Int) 3243ab = [(3243,"ab")]
+(readOct::ReadS Integer) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Integer) 0 = [(0,"")]
+(readOct::ReadS Integer) -1 = []
+(readOct::ReadS Integer) 1 = [(1,"")]
+(readOct::ReadS Integer) 34323 = [(14547,"")]
+(readOct::ReadS Integer) 2L = [(2,"L")]
+(readOct::ReadS Integer) 012 = [(10,"")]
+(readOct::ReadS Integer) 0x23 = [(0,"x23")]
+(readOct::ReadS Integer) 3243ab = [(1699,"ab")]
+(readOct::ReadS Int) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Int) 0 = [(0,"")]
+(readOct::ReadS Int) -1 = []
+(readOct::ReadS Int) 1 = [(1,"")]
+(readOct::ReadS Int) 34323 = [(14547,"")]
+(readOct::ReadS Int) 2L = [(2,"L")]
+(readOct::ReadS Int) 012 = [(10,"")]
+(readOct::ReadS Int) 0x23 = [(0,"x23")]
+(readOct::ReadS Int) 3243ab = [(1699,"ab")]
+(readHex::ReadS Integer) 3489348394032498320438240938403 = [(4364516597526947317207336190131536899,"")]
+(readHex::ReadS Integer) 0 = [(0,"")]
+(readHex::ReadS Integer) -1 = []
+(readHex::ReadS Integer) 1 = [(1,"")]
+(readHex::ReadS Integer) 34323 = [(213795,"")]
+(readHex::ReadS Integer) 2L = [(2,"L")]
+(readHex::ReadS Integer) 012 = [(18,"")]
+(readHex::ReadS Integer) 0x23 = [(0,"x23")]
+(readHex::ReadS Integer) 3243ab = [(3294123,"")]
+(readHex::ReadS Int) 3489348394032498320438240938403 = [(1083409411,"")]
+(readHex::ReadS Int) 0 = [(0,"")]
+(readHex::ReadS Int) -1 = []
+(readHex::ReadS Int) 1 = [(1,"")]
+(readHex::ReadS Int) 34323 = [(213795,"")]
+(readHex::ReadS Int) 2L = [(2,"L")]
+(readHex::ReadS Int) 012 = [(18,"")]
+(readHex::ReadS Int) 0x23 = [(0,"x23")]
+(readHex::ReadS Int) 3243ab = [(3294123,"")]
diff --git a/testsuite/tests/lib/Numeric/num005.stdout-alpha-dec-osf3 b/testsuite/tests/lib/Numeric/num005.stdout-alpha-dec-osf3
new file mode 100644
index 0000000000..35678af82f
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num005.stdout-alpha-dec-osf3
@@ -0,0 +1,55 @@
+
+(readDec::ReadS Integer) 3489348394032498320438240938403 = [(3489348394032498320438240938403,"")]
+(readDec::ReadS Integer) 0 = [(0,"")]
+(readDec::ReadS Integer) -1 = []
+(readDec::ReadS Integer) 1 = [(1,"")]
+(readDec::ReadS Integer) 34323 = [(34323,"")]
+(readDec::ReadS Integer) 2L = [(2,"L")]
+(readDec::ReadS Integer) 012 = [(12,"")]
+(readDec::ReadS Integer) 0x23 = [(0,"x23")]
+(readDec::ReadS Integer) 3243ab = [(3243,"ab")]
+(readDec::ReadS Int) 3489348394032498320438240938403 = [(8154046292665502115,"")]
+(readDec::ReadS Int) 0 = [(0,"")]
+(readDec::ReadS Int) -1 = []
+(readDec::ReadS Int) 1 = [(1,"")]
+(readDec::ReadS Int) 34323 = [(34323,"")]
+(readDec::ReadS Int) 2L = [(2,"L")]
+(readDec::ReadS Int) 012 = [(12,"")]
+(readDec::ReadS Int) 0x23 = [(0,"x23")]
+(readDec::ReadS Int) 3243ab = [(3243,"ab")]
+(readOct::ReadS Integer) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Integer) 0 = [(0,"")]
+(readOct::ReadS Integer) -1 = []
+(readOct::ReadS Integer) 1 = [(1,"")]
+(readOct::ReadS Integer) 34323 = [(14547,"")]
+(readOct::ReadS Integer) 2L = [(2,"L")]
+(readOct::ReadS Integer) 012 = [(10,"")]
+(readOct::ReadS Integer) 0x23 = [(0,"x23")]
+(readOct::ReadS Integer) 3243ab = [(1699,"ab")]
+(readOct::ReadS Int) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Int) 0 = [(0,"")]
+(readOct::ReadS Int) -1 = []
+(readOct::ReadS Int) 1 = [(1,"")]
+(readOct::ReadS Int) 34323 = [(14547,"")]
+(readOct::ReadS Int) 2L = [(2,"L")]
+(readOct::ReadS Int) 012 = [(10,"")]
+(readOct::ReadS Int) 0x23 = [(0,"x23")]
+(readOct::ReadS Int) 3243ab = [(1699,"ab")]
+(readHex::ReadS Integer) 3489348394032498320438240938403 = [(4364516597526947317207336190131536899,"")]
+(readHex::ReadS Integer) 0 = [(0,"")]
+(readHex::ReadS Integer) -1 = []
+(readHex::ReadS Integer) 1 = [(1,"")]
+(readHex::ReadS Integer) 34323 = [(213795,"")]
+(readHex::ReadS Integer) 2L = [(2,"L")]
+(readHex::ReadS Integer) 012 = [(18,"")]
+(readHex::ReadS Integer) 0x23 = [(0,"x23")]
+(readHex::ReadS Integer) 3243ab = [(3294123,"")]
+(readHex::ReadS Int) 3489348394032498320438240938403 = [(-8998117828778032125,"")]
+(readHex::ReadS Int) 0 = [(0,"")]
+(readHex::ReadS Int) -1 = []
+(readHex::ReadS Int) 1 = [(1,"")]
+(readHex::ReadS Int) 34323 = [(213795,"")]
+(readHex::ReadS Int) 2L = [(2,"L")]
+(readHex::ReadS Int) 012 = [(18,"")]
+(readHex::ReadS Int) 0x23 = [(0,"x23")]
+(readHex::ReadS Int) 3243ab = [(3294123,"")]
diff --git a/testsuite/tests/lib/Numeric/num005.stdout-mips-sgi-irix b/testsuite/tests/lib/Numeric/num005.stdout-mips-sgi-irix
new file mode 100644
index 0000000000..35678af82f
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num005.stdout-mips-sgi-irix
@@ -0,0 +1,55 @@
+
+(readDec::ReadS Integer) 3489348394032498320438240938403 = [(3489348394032498320438240938403,"")]
+(readDec::ReadS Integer) 0 = [(0,"")]
+(readDec::ReadS Integer) -1 = []
+(readDec::ReadS Integer) 1 = [(1,"")]
+(readDec::ReadS Integer) 34323 = [(34323,"")]
+(readDec::ReadS Integer) 2L = [(2,"L")]
+(readDec::ReadS Integer) 012 = [(12,"")]
+(readDec::ReadS Integer) 0x23 = [(0,"x23")]
+(readDec::ReadS Integer) 3243ab = [(3243,"ab")]
+(readDec::ReadS Int) 3489348394032498320438240938403 = [(8154046292665502115,"")]
+(readDec::ReadS Int) 0 = [(0,"")]
+(readDec::ReadS Int) -1 = []
+(readDec::ReadS Int) 1 = [(1,"")]
+(readDec::ReadS Int) 34323 = [(34323,"")]
+(readDec::ReadS Int) 2L = [(2,"L")]
+(readDec::ReadS Int) 012 = [(12,"")]
+(readDec::ReadS Int) 0x23 = [(0,"x23")]
+(readDec::ReadS Int) 3243ab = [(3243,"ab")]
+(readOct::ReadS Integer) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Integer) 0 = [(0,"")]
+(readOct::ReadS Integer) -1 = []
+(readOct::ReadS Integer) 1 = [(1,"")]
+(readOct::ReadS Integer) 34323 = [(14547,"")]
+(readOct::ReadS Integer) 2L = [(2,"L")]
+(readOct::ReadS Integer) 012 = [(10,"")]
+(readOct::ReadS Integer) 0x23 = [(0,"x23")]
+(readOct::ReadS Integer) 3243ab = [(1699,"ab")]
+(readOct::ReadS Int) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Int) 0 = [(0,"")]
+(readOct::ReadS Int) -1 = []
+(readOct::ReadS Int) 1 = [(1,"")]
+(readOct::ReadS Int) 34323 = [(14547,"")]
+(readOct::ReadS Int) 2L = [(2,"L")]
+(readOct::ReadS Int) 012 = [(10,"")]
+(readOct::ReadS Int) 0x23 = [(0,"x23")]
+(readOct::ReadS Int) 3243ab = [(1699,"ab")]
+(readHex::ReadS Integer) 3489348394032498320438240938403 = [(4364516597526947317207336190131536899,"")]
+(readHex::ReadS Integer) 0 = [(0,"")]
+(readHex::ReadS Integer) -1 = []
+(readHex::ReadS Integer) 1 = [(1,"")]
+(readHex::ReadS Integer) 34323 = [(213795,"")]
+(readHex::ReadS Integer) 2L = [(2,"L")]
+(readHex::ReadS Integer) 012 = [(18,"")]
+(readHex::ReadS Integer) 0x23 = [(0,"x23")]
+(readHex::ReadS Integer) 3243ab = [(3294123,"")]
+(readHex::ReadS Int) 3489348394032498320438240938403 = [(-8998117828778032125,"")]
+(readHex::ReadS Int) 0 = [(0,"")]
+(readHex::ReadS Int) -1 = []
+(readHex::ReadS Int) 1 = [(1,"")]
+(readHex::ReadS Int) 34323 = [(213795,"")]
+(readHex::ReadS Int) 2L = [(2,"L")]
+(readHex::ReadS Int) 012 = [(18,"")]
+(readHex::ReadS Int) 0x23 = [(0,"x23")]
+(readHex::ReadS Int) 3243ab = [(3294123,"")]
diff --git a/testsuite/tests/lib/Numeric/num005.stdout-ws-64 b/testsuite/tests/lib/Numeric/num005.stdout-ws-64
new file mode 100644
index 0000000000..35678af82f
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num005.stdout-ws-64
@@ -0,0 +1,55 @@
+
+(readDec::ReadS Integer) 3489348394032498320438240938403 = [(3489348394032498320438240938403,"")]
+(readDec::ReadS Integer) 0 = [(0,"")]
+(readDec::ReadS Integer) -1 = []
+(readDec::ReadS Integer) 1 = [(1,"")]
+(readDec::ReadS Integer) 34323 = [(34323,"")]
+(readDec::ReadS Integer) 2L = [(2,"L")]
+(readDec::ReadS Integer) 012 = [(12,"")]
+(readDec::ReadS Integer) 0x23 = [(0,"x23")]
+(readDec::ReadS Integer) 3243ab = [(3243,"ab")]
+(readDec::ReadS Int) 3489348394032498320438240938403 = [(8154046292665502115,"")]
+(readDec::ReadS Int) 0 = [(0,"")]
+(readDec::ReadS Int) -1 = []
+(readDec::ReadS Int) 1 = [(1,"")]
+(readDec::ReadS Int) 34323 = [(34323,"")]
+(readDec::ReadS Int) 2L = [(2,"L")]
+(readDec::ReadS Int) 012 = [(12,"")]
+(readDec::ReadS Int) 0x23 = [(0,"x23")]
+(readDec::ReadS Int) 3243ab = [(3243,"ab")]
+(readOct::ReadS Integer) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Integer) 0 = [(0,"")]
+(readOct::ReadS Integer) -1 = []
+(readOct::ReadS Integer) 1 = [(1,"")]
+(readOct::ReadS Integer) 34323 = [(14547,"")]
+(readOct::ReadS Integer) 2L = [(2,"L")]
+(readOct::ReadS Integer) 012 = [(10,"")]
+(readOct::ReadS Integer) 0x23 = [(0,"x23")]
+(readOct::ReadS Integer) 3243ab = [(1699,"ab")]
+(readOct::ReadS Int) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Int) 0 = [(0,"")]
+(readOct::ReadS Int) -1 = []
+(readOct::ReadS Int) 1 = [(1,"")]
+(readOct::ReadS Int) 34323 = [(14547,"")]
+(readOct::ReadS Int) 2L = [(2,"L")]
+(readOct::ReadS Int) 012 = [(10,"")]
+(readOct::ReadS Int) 0x23 = [(0,"x23")]
+(readOct::ReadS Int) 3243ab = [(1699,"ab")]
+(readHex::ReadS Integer) 3489348394032498320438240938403 = [(4364516597526947317207336190131536899,"")]
+(readHex::ReadS Integer) 0 = [(0,"")]
+(readHex::ReadS Integer) -1 = []
+(readHex::ReadS Integer) 1 = [(1,"")]
+(readHex::ReadS Integer) 34323 = [(213795,"")]
+(readHex::ReadS Integer) 2L = [(2,"L")]
+(readHex::ReadS Integer) 012 = [(18,"")]
+(readHex::ReadS Integer) 0x23 = [(0,"x23")]
+(readHex::ReadS Integer) 3243ab = [(3294123,"")]
+(readHex::ReadS Int) 3489348394032498320438240938403 = [(-8998117828778032125,"")]
+(readHex::ReadS Int) 0 = [(0,"")]
+(readHex::ReadS Int) -1 = []
+(readHex::ReadS Int) 1 = [(1,"")]
+(readHex::ReadS Int) 34323 = [(213795,"")]
+(readHex::ReadS Int) 2L = [(2,"L")]
+(readHex::ReadS Int) 012 = [(18,"")]
+(readHex::ReadS Int) 0x23 = [(0,"x23")]
+(readHex::ReadS Int) 3243ab = [(3294123,"")]
diff --git a/testsuite/tests/lib/Numeric/num005.stdout-x86_64-unknown-openbsd b/testsuite/tests/lib/Numeric/num005.stdout-x86_64-unknown-openbsd
new file mode 100644
index 0000000000..35678af82f
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num005.stdout-x86_64-unknown-openbsd
@@ -0,0 +1,55 @@
+
+(readDec::ReadS Integer) 3489348394032498320438240938403 = [(3489348394032498320438240938403,"")]
+(readDec::ReadS Integer) 0 = [(0,"")]
+(readDec::ReadS Integer) -1 = []
+(readDec::ReadS Integer) 1 = [(1,"")]
+(readDec::ReadS Integer) 34323 = [(34323,"")]
+(readDec::ReadS Integer) 2L = [(2,"L")]
+(readDec::ReadS Integer) 012 = [(12,"")]
+(readDec::ReadS Integer) 0x23 = [(0,"x23")]
+(readDec::ReadS Integer) 3243ab = [(3243,"ab")]
+(readDec::ReadS Int) 3489348394032498320438240938403 = [(8154046292665502115,"")]
+(readDec::ReadS Int) 0 = [(0,"")]
+(readDec::ReadS Int) -1 = []
+(readDec::ReadS Int) 1 = [(1,"")]
+(readDec::ReadS Int) 34323 = [(34323,"")]
+(readDec::ReadS Int) 2L = [(2,"L")]
+(readDec::ReadS Int) 012 = [(12,"")]
+(readDec::ReadS Int) 0x23 = [(0,"x23")]
+(readDec::ReadS Int) 3243ab = [(3243,"ab")]
+(readOct::ReadS Integer) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Integer) 0 = [(0,"")]
+(readOct::ReadS Integer) -1 = []
+(readOct::ReadS Integer) 1 = [(1,"")]
+(readOct::ReadS Integer) 34323 = [(14547,"")]
+(readOct::ReadS Integer) 2L = [(2,"L")]
+(readOct::ReadS Integer) 012 = [(10,"")]
+(readOct::ReadS Integer) 0x23 = [(0,"x23")]
+(readOct::ReadS Integer) 3243ab = [(1699,"ab")]
+(readOct::ReadS Int) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Int) 0 = [(0,"")]
+(readOct::ReadS Int) -1 = []
+(readOct::ReadS Int) 1 = [(1,"")]
+(readOct::ReadS Int) 34323 = [(14547,"")]
+(readOct::ReadS Int) 2L = [(2,"L")]
+(readOct::ReadS Int) 012 = [(10,"")]
+(readOct::ReadS Int) 0x23 = [(0,"x23")]
+(readOct::ReadS Int) 3243ab = [(1699,"ab")]
+(readHex::ReadS Integer) 3489348394032498320438240938403 = [(4364516597526947317207336190131536899,"")]
+(readHex::ReadS Integer) 0 = [(0,"")]
+(readHex::ReadS Integer) -1 = []
+(readHex::ReadS Integer) 1 = [(1,"")]
+(readHex::ReadS Integer) 34323 = [(213795,"")]
+(readHex::ReadS Integer) 2L = [(2,"L")]
+(readHex::ReadS Integer) 012 = [(18,"")]
+(readHex::ReadS Integer) 0x23 = [(0,"x23")]
+(readHex::ReadS Integer) 3243ab = [(3294123,"")]
+(readHex::ReadS Int) 3489348394032498320438240938403 = [(-8998117828778032125,"")]
+(readHex::ReadS Int) 0 = [(0,"")]
+(readHex::ReadS Int) -1 = []
+(readHex::ReadS Int) 1 = [(1,"")]
+(readHex::ReadS Int) 34323 = [(213795,"")]
+(readHex::ReadS Int) 2L = [(2,"L")]
+(readHex::ReadS Int) 012 = [(18,"")]
+(readHex::ReadS Int) 0x23 = [(0,"x23")]
+(readHex::ReadS Int) 3243ab = [(3294123,"")]
diff --git a/testsuite/tests/lib/Numeric/num006.hs b/testsuite/tests/lib/Numeric/num006.hs
new file mode 100644
index 0000000000..f421ed72a2
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num006.hs
@@ -0,0 +1,28 @@
+-- Exercising the showing of positive numbers at various bases.
+--
+module Main(main) where
+
+import Numeric
+import Data.Char
+
+--showDec :: Integral a => a -> ShowS
+showDec = showInt
+
+{-
+--showBinary :: Integral a => a -> ShowS
+showBinary n r =
+ showString "0b" $
+ showIntAtBase 2 (toChr) n r
+ where toChr d = chr (ord '0' + fromIntegral d)
+-}
+
+main =
+ do
+ print (map (\ x -> showOct x []) [1..32])
+ print (map (\ x -> showDec x []) [1..32])
+ print (map (\ x -> showHex x []) [1..32])
+-- print (map (\ x -> showBinary x []) [1..32])
+ putStrLn (showOct (241324784::Int) [])
+ putStrLn (showDec (241324784::Int) [])
+ putStrLn (showHex (241324784::Int) [])
+--- putStrLn (showBinary (241324784::Int) [])
diff --git a/testsuite/tests/lib/Numeric/num006.stdout b/testsuite/tests/lib/Numeric/num006.stdout
new file mode 100644
index 0000000000..e0c45403ec
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num006.stdout
@@ -0,0 +1,6 @@
+["1","2","3","4","5","6","7","10","11","12","13","14","15","16","17","20","21","22","23","24","25","26","27","30","31","32","33","34","35","36","37","40"]
+["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32"]
+["1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20"]
+1630451360
+241324784
+e6252f0
diff --git a/testsuite/tests/lib/Numeric/num007.hs b/testsuite/tests/lib/Numeric/num007.hs
new file mode 100644
index 0000000000..1c40ecfdbd
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num007.hs
@@ -0,0 +1,17 @@
+-- Exercising the reading of positive numbers at various bases.
+--
+module Main(main) where
+
+import Numeric
+
+main =
+ do
+ putStrLn (show (readOct "00000111"))
+ putStrLn (show (readDec "00000111"))
+ putStrLn (show (readHex "00000111"))
+ putStrLn (show (readOct "-24"))
+ putStrLn (show (readDec "-24"))
+ putStrLn (show (readHex "-24"))
+ putStrLn (show ((readOct ::ReadS Integer) "3248784372843778438743"))
+ putStrLn (show ((readDec ::ReadS Integer) "3248784372843778438743"))
+ putStrLn (show ((readHex ::ReadS Integer) "3248784372843778438743"))
diff --git a/testsuite/tests/lib/Numeric/num007.stdout b/testsuite/tests/lib/Numeric/num007.stdout
new file mode 100644
index 0000000000..ef60021827
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num007.stdout
@@ -0,0 +1,9 @@
+[(73,"")]
+[(111,"")]
+[(273,"")]
+[]
+[]
+[]
+[(212,"8784372843778438743")]
+[(3248784372843778438743,"")]
+[(60788519836879239998834499,"")]
diff --git a/testsuite/tests/lib/Numeric/num008.hs b/testsuite/tests/lib/Numeric/num008.hs
new file mode 100644
index 0000000000..36158240b4
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num008.hs
@@ -0,0 +1,57 @@
+-- showing/reading floats
+--
+module Main(main) where
+
+import Numeric
+
+main = do
+ let dbls = map (shEFloat (Just 7)) doubles
+ ++ map (shEFloat (Just 0)) doubles
+ ++ map (shEFloat Nothing) doubles
+ ++ map (shFFloat (Just 7)) doubles
+ ++ map (shFFloat (Just 0)) doubles
+ ++ map (shFFloat Nothing) doubles
+ ++ map (shGFloat (Just 7)) doubles
+ ++ map (shGFloat (Just 0)) doubles
+ ++ map (shGFloat Nothing) doubles
+
+ flts = map (shEFloat (Just 7)) floats
+ ++ map (shEFloat (Just 0)) floats
+ ++ map (shEFloat Nothing) floats
+ ++ map (shFFloat (Just 7)) floats
+ ++ map (shFFloat (Just 0)) floats
+ ++ map (shFFloat Nothing) floats
+ ++ map (shGFloat (Just 7)) floats
+ ++ map (shGFloat (Just 0)) floats
+ ++ map (shGFloat Nothing) floats
+
+ putStrLn (unlines dbls)
+ putStrLn (unlines flts)
+ print (map read dbls :: [Double])
+ print (map read flts :: [Double])
+
+shEFloat p f = showEFloat p f ""
+shFFloat p f = showFFloat p f ""
+shGFloat p f = showGFloat p f ""
+
+doubles :: [ Double ]
+doubles = [ 0.0
+ , 420
+ , 42
+ , 4.2
+ , 0.42
+ , 0.042
+ , 1.82173691287639817263897126389712638972163
+ , 1.82173691287639817263897126389712638972163e-300
+ ]
+
+floats :: [ Float ]
+floats = [ 0.0
+ , 420
+ , 42
+ , 4.2
+ , 0.42
+ , 0.042
+ , 1.82173691287639817263897126389712638972163
+ , 1.82173691287639817263897126389712638972163e-300
+ ]
diff --git a/testsuite/tests/lib/Numeric/num008.stdout b/testsuite/tests/lib/Numeric/num008.stdout
new file mode 100644
index 0000000000..5086442f0f
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num008.stdout
@@ -0,0 +1,148 @@
+0.0000000e0
+4.2000000e2
+4.2000000e1
+4.2000000e0
+4.2000000e-1
+4.2000000e-2
+1.8217369e0
+1.8217369e-300
+0.0e0
+4.2e2
+4.2e1
+4.2e0
+4.2e-1
+4.2e-2
+1.8e0
+1.8e-300
+0.0e0
+4.2e2
+4.2e1
+4.2e0
+4.2e-1
+4.2e-2
+1.8217369128763983e0
+1.821736912876398e-300
+0.0000000
+420.0000000
+42.0000000
+4.2000000
+0.4200000
+0.0420000
+1.8217369
+0.0000000
+0
+420
+42
+4
+0
+0
+2
+0
+0.0
+420.0
+42.0
+4.2
+0.42
+0.042
+1.8217369128763983
+0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001821736912876398
+0.0000000
+420.0000000
+42.0000000
+4.2000000
+0.4200000
+4.2000000e-2
+1.8217369
+1.8217369e-300
+0
+420
+42
+4
+0
+4.2e-2
+2
+1.8e-300
+0.0
+420.0
+42.0
+4.2
+0.42
+4.2e-2
+1.8217369128763983
+1.821736912876398e-300
+
+0.0000000e0
+4.2000000e2
+4.2000000e1
+4.2000000e0
+4.2000000e-1
+4.2000000e-2
+1.8217369e0
+0.0000000e0
+0.0e0
+4.2e2
+4.2e1
+4.2e0
+4.2e-1
+4.2e-2
+1.8e0
+0.0e0
+0.0e0
+4.2e2
+4.2e1
+4.2e0
+4.2e-1
+4.2e-2
+1.8217369e0
+0.0e0
+0.0000000
+420.0000000
+42.0000000
+4.2000000
+0.4200000
+0.0420000
+1.8217369
+0.0000000
+0
+420
+42
+4
+0
+0
+2
+0
+0.0
+420.0
+42.0
+4.2
+0.42
+0.042
+1.8217369
+0.0
+0.0000000
+420.0000000
+42.0000000
+4.2000000
+0.4200000
+4.2000000e-2
+1.8217369
+0.0000000
+0
+420
+42
+4
+0
+4.2e-2
+2
+0
+0.0
+420.0
+42.0
+4.2
+0.42
+4.2e-2
+1.8217369
+0.0
+
+[0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,1.8217369e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8,1.8e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369128763983,1.821736912876398e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.0,0.0,0.0,2.0,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369128763983,1.821736912876398e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,1.8217369e-300,0.0,420.0,42.0,4.0,0.0,4.2e-2,2.0,1.8e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369128763983,1.821736912876398e-300]
+[0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.0,0.0,0.0,2.0,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.0,0.0,4.2e-2,2.0,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0]
diff --git a/testsuite/tests/lib/Numeric/num009.hs b/testsuite/tests/lib/Numeric/num009.hs
new file mode 100644
index 0000000000..6910f2f840
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num009.hs
@@ -0,0 +1,39 @@
+-- trac #2059
+
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+module Main(main) where
+
+import Control.Monad
+import Foreign.C
+
+main = do let d = 1e20 :: Double
+ f = 1e20 :: Float
+ test "sind" sind sin d
+ test "sinf" sinf sin f
+ test "cosd" cosd cos d
+ test "cosf" cosf cos f
+ test "tand" tand tan d
+ test "tanf" tanf tan f
+ putStrLn "Done"
+
+test :: (RealFloat a, Floating a, RealFloat b, Floating b)
+ => String -> (a -> a) -> (b -> b) -> b -> IO ()
+test s f g x = do let y = realToFrac (f (realToFrac x))
+ z = g x
+ unless (y == z) $ do
+ putStrLn s
+ print y
+ print z
+ print $ decodeFloat y
+ print $ decodeFloat z
+
+foreign import ccall "math.h sin" sind :: CDouble -> CDouble
+foreign import ccall "math.h sinf" sinf :: CFloat -> CFloat
+
+foreign import ccall "math.h cos" cosd :: CDouble -> CDouble
+foreign import ccall "math.h cosf" cosf :: CFloat -> CFloat
+
+foreign import ccall "math.h tan" tand :: CDouble -> CDouble
+foreign import ccall "math.h tanf" tanf :: CFloat -> CFloat
+
diff --git a/testsuite/tests/lib/Numeric/num009.stdout b/testsuite/tests/lib/Numeric/num009.stdout
new file mode 100644
index 0000000000..a965a70ed4
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num009.stdout
@@ -0,0 +1 @@
+Done
diff --git a/testsuite/tests/lib/Numeric/num010.hs b/testsuite/tests/lib/Numeric/num010.hs
new file mode 100644
index 0000000000..bf1d5a2734
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num010.hs
@@ -0,0 +1,29 @@
+
+module Main(main) where
+
+main = sequence_ [ f x y | x <- [0,
+ 1000,
+ 1000000000000, -- > 2^32
+ 1000000000000000000000000, -- > 2^64
+ -1000,
+ -1000000000000, -- < -2^32
+ -1000000000000000000000000] -- < -2^64
+ , y <- [0, -10, 10] ]
+
+f :: Integer -> Int -> IO ()
+f x y = do putStrLn "------------------------"
+ print x
+ print y
+ let d :: Double
+ d = encodeFloat x y
+ (xd, yd) = decodeFloat d
+ let f :: Float
+ f = encodeFloat x y
+ (xf, yf) = decodeFloat f
+ print d
+ print xd
+ print yd
+ print f
+ print xf
+ print yf
+
diff --git a/testsuite/tests/lib/Numeric/num010.stdout b/testsuite/tests/lib/Numeric/num010.stdout
new file mode 100644
index 0000000000..877d35c722
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num010.stdout
@@ -0,0 +1,189 @@
+------------------------
+0
+0
+0.0
+0
+0
+0.0
+0
+0
+------------------------
+0
+-10
+0.0
+0
+0
+0.0
+0
+0
+------------------------
+0
+10
+0.0
+0
+0
+0.0
+0
+0
+------------------------
+1000
+0
+1000.0
+8796093022208000
+-43
+1000.0
+16384000
+-14
+------------------------
+1000
+-10
+0.9765625
+8796093022208000
+-53
+0.9765625
+16384000
+-24
+------------------------
+1000
+10
+1024000.0
+8796093022208000
+-33
+1024000.0
+16384000
+-4
+------------------------
+1000000000000
+0
+1.0e12
+8192000000000000
+-13
+1.0e12
+15258789
+16
+------------------------
+1000000000000
+-10
+9.765625e8
+8192000000000000
+-23
+9.765625e8
+15258789
+6
+------------------------
+1000000000000
+10
+1.024e15
+8192000000000000
+-3
+1.024e15
+15258789
+26
+------------------------
+1000000000000000000000000
+0
+1.0e24
+7450580596923828
+27
+1.0e24
+13877788
+56
+------------------------
+1000000000000000000000000
+-10
+9.765625e20
+7450580596923828
+17
+9.765625e20
+13877788
+46
+------------------------
+1000000000000000000000000
+10
+1.024e27
+7450580596923828
+37
+1.024e27
+13877788
+66
+------------------------
+-1000
+0
+-1000.0
+-8796093022208000
+-43
+-1000.0
+-16384000
+-14
+------------------------
+-1000
+-10
+-0.9765625
+-8796093022208000
+-53
+-0.9765625
+-16384000
+-24
+------------------------
+-1000
+10
+-1024000.0
+-8796093022208000
+-33
+-1024000.0
+-16384000
+-4
+------------------------
+-1000000000000
+0
+-1.0e12
+-8192000000000000
+-13
+-1.0e12
+-15258789
+16
+------------------------
+-1000000000000
+-10
+-9.765625e8
+-8192000000000000
+-23
+-9.765625e8
+-15258789
+6
+------------------------
+-1000000000000
+10
+-1.024e15
+-8192000000000000
+-3
+-1.024e15
+-15258789
+26
+------------------------
+-1000000000000000000000000
+0
+-1.0e24
+-7450580596923828
+27
+-1.0e24
+-13877788
+56
+------------------------
+-1000000000000000000000000
+-10
+-9.765625e20
+-7450580596923828
+17
+-9.765625e20
+-13877788
+46
+------------------------
+-1000000000000000000000000
+10
+-1.024e27
+-7450580596923828
+37
+-1.024e27
+-13877788
+66