Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
7dc97329
Commit
7dc97329
authored
Jun 04, 2008
by
Ian Lynagh
Browse files
Add a test for Integer-Float/Double conversions
parent
e0248bf9
Changes
3
Hide whitespace changes
Inline
Side-by-side
testsuite/tests/ghc-regress/lib/Numeric/all.T
View file @
7dc97329
...
...
@@ -7,3 +7,4 @@ test('num006', normal, compile_and_run, [''])
test
('
num007
',
normal
,
compile_and_run
,
[''])
test
('
num008
',
normal
,
compile_and_run
,
[''])
test
('
num009
',
normal
,
compile_and_run
,
[''])
test
('
num010
',
normal
,
compile_and_run
,
[''])
testsuite/tests/ghc-regress/lib/Numeric/num010.hs
0 → 100644
View file @
7dc97329
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
testsuite/tests/ghc-regress/lib/Numeric/num010.stdout
0 → 100644
View file @
7dc97329
------------------------
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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment