Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gesh
GHC
Commits
9b92f83d
Commit
9b92f83d
authored
27 years ago
by
sof
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1998-01-29 13:49:38 by sof]
Added test case for showing Floats and Doubles.
parent
d67e82cf
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ghc/tests/numeric/should_run/arith005.hs
+33
-46
33 additions, 46 deletions
ghc/tests/numeric/should_run/arith005.hs
ghc/tests/numeric/should_run/arith005.stdout
+22
-20
22 additions, 20 deletions
ghc/tests/numeric/should_run/arith005.stdout
with
55 additions
and
66 deletions
ghc/tests/numeric/should_run/arith005.hs
+
33
−
46
View file @
9b92f83d
--!!!
test
RealFrac
ops
(
ceiling
/
floor
/
etc
.
)
on
Floats
/
Doubles
--
main
=
putStr
(
-- {Float,Double} inputs, {Int,Integer} outputs
show
((
map
ceiling
float_list
)
::
[
Int
])
++
"
\n
"
++
show
((
map
ceiling
float_list
)
::
[
Integer
])
++
"
\n
"
++
show
((
map
ceiling
double_list
)
::
[
Int
])
++
"
\n
"
++
show
((
map
ceiling
double_list
)
::
[
Integer
])
++
"
\n
"
++
show
((
map
floor
float_list
)
::
[
Int
])
++
"
\n
"
++
show
((
map
floor
float_list
)
::
[
Integer
])
++
"
\n
"
++
show
((
map
floor
double_list
)
::
[
Int
])
++
"
\n
"
++
show
((
map
floor
double_list
)
::
[
Integer
])
++
"
\n
"
++
show
((
map
truncate
float_list
)
::
[
Int
])
++
"
\n
"
++
show
((
map
truncate
float_list
)
::
[
Integer
])
++
"
\n
"
++
show
((
map
truncate
double_list
)
::
[
Int
])
++
"
\n
"
++
show
((
map
truncate
double_list
)
::
[
Integer
])
++
"
\n
"
++
show
((
map
round
float_list
)
::
[
Int
])
++
"
\n
"
++
show
((
map
round
float_list
)
::
[
Integer
])
++
"
\n
"
++
show
((
map
round
double_list
)
::
[
Int
])
++
"
\n
"
++
show
((
map
round
double_list
)
::
[
Integer
])
++
"
\n
"
++
show
((
map
properFraction
float_list
)
::
[(
Int
,
Float
)])
++
"
\n
"
++
show
((
map
properFraction
float_list
)
::
[(
Integer
,
Float
)])
++
"
\n
"
++
show
((
map
properFraction
double_list
)
::
[(
Int
,
Double
)])
++
"
\n
"
++
show
((
map
properFraction
double_list
)
::
[(
Integer
,
Double
)])
++
"
\n
"
)
main
=
putStr
$
unlines
[
-- just for fun, we show the floats to
-- exercise the code responsible.
show
(
float_list
::
[
Float
])
,
show
(
double_list
::
[
Double
])
-- {Float,Double} inputs, {Int,Integer} outputs
,
show
((
map
ceiling
float_list
)
::
[
Int
])
,
show
((
map
ceiling
float_list
)
::
[
Integer
])
,
show
((
map
ceiling
double_list
)
::
[
Int
])
,
show
((
map
ceiling
double_list
)
::
[
Integer
])
,
show
((
map
floor
float_list
)
::
[
Int
])
,
show
((
map
floor
float_list
)
::
[
Integer
])
,
show
((
map
floor
double_list
)
::
[
Int
])
,
show
((
map
floor
double_list
)
::
[
Integer
])
,
show
((
map
truncate
float_list
)
::
[
Int
])
,
show
((
map
truncate
float_list
)
::
[
Integer
])
,
show
((
map
truncate
double_list
)
::
[
Int
])
,
show
((
map
truncate
double_list
)
::
[
Integer
])
,
show
((
map
round
float_list
)
::
[
Int
])
,
show
((
map
round
float_list
)
::
[
Integer
])
,
show
((
map
round
double_list
)
::
[
Int
])
,
show
((
map
round
double_list
)
::
[
Integer
])
,
show
((
map
properFraction
float_list
)
::
[(
Int
,
Float
)])
,
show
((
map
properFraction
float_list
)
::
[(
Integer
,
Float
)])
,
show
((
map
properFraction
double_list
)
::
[(
Int
,
Double
)])
,
show
((
map
properFraction
double_list
)
::
[(
Integer
,
Double
)])
]
where
float_list
::
[
Float
]
float_list
=
[
0.0
,
-
0.0
,
1.1
,
2.8
,
3.5
,
4.5
,
-
1.0000000001
,
-
2.9999995
,
-
3.50000000001
,
-
4.49999999999
,
1000012.0
,
123.456
,
100.25
,
102.5
,
0.0012
,
-
0.00000012
,
1.7e4
,
-
1.7e-4
,
0.15e-6
,
pi
102.5
,
0.0012
,
-
0.00000012
,
1.7e4
,
-
1.7e-4
,
0.15e-6
,
pi
,
1.18088e+11
,
1.2111e+14
]
double_list
::
[
Double
]
double_list
=
[
0.0
,
-
0.0
,
1.1
,
2.8
,
3.5
,
4.5
,
-
1.0000000001
,
-
2.9999995
,
-
3.50000000001
,
-
4.49999999999
,
1000012.0
,
123.456
,
100.25
,
102.5
,
0.0012
,
-
0.00000012
,
1.7e4
,
-
1.7e-4
,
0.15e-6
,
pi
102.5
,
0.0012
,
-
0.00000012
,
1.7e4
,
-
1.7e-4
,
0.15e-6
,
pi
,
1.18088e+11
,
1.2111e+14
]
This diff is collapsed.
Click to expand it.
ghc/tests/numeric/should_run/arith005.stdout
+
22
−
20
View file @
9b92f83d
[0, 0, 2, 3, 4, 5, -1, -2, -3, -4, 1000012, 124, 101, 103, 1, 0, 17000, 0, 1, 4]
[0, 0, 2, 3, 4, 5, -1, -2, -3, -4, 1000012, 124, 101, 103, 1, 0, 17000, 0, 1, 4]
[0, 0, 2, 3, 4, 5, -1, -2, -3, -4, 1000012, 124, 101, 103, 1, 0, 17000, 0, 1, 4]
[0, 0, 2, 3, 4, 5, -1, -2, -3, -4, 1000012, 124, 101, 103, 1, 0, 17000, 0, 1, 4]
[0, 0, 1, 2, 3, 4, -1, -3, -4, -5, 1000012, 123, 100, 102, 0, -1, 17000, -1, 0, 3]
[0, 0, 1, 2, 3, 4, -1, -3, -4, -5, 1000012, 123, 100, 102, 0, -1, 17000, -1, 0, 3]
[0, 0, 1, 2, 3, 4, -2, -3, -4, -5, 1000012, 123, 100, 102, 0, -1, 17000, -1, 0, 3]
[0, 0, 1, 2, 3, 4, -2, -3, -4, -5, 1000012, 123, 100, 102, 0, -1, 17000, -1, 0, 3]
[0, 0, 1, 2, 3, 4, -1, -2, -3, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3]
[0, 0, 1, 2, 3, 4, -1, -2, -3, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3]
[0, 0, 1, 2, 3, 4, -1, -2, -3, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3]
[0, 0, 1, 2, 3, 4, -1, -2, -3, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3]
[0, 0, 1, 3, 4, 4, -1, -3, -4, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3]
[0, 0, 1, 3, 4, 4, -1, -3, -4, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3]
[0, 0, 1, 3, 4, 4, -1, -3, -4, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3]
[0, 0, 1, 3, 4, 4, -1, -3, -4, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3]
[(0, 0.0), (0, 0.0), (1, 0.100000024), (2, 0.79999995), (3, 0.5), (4, 0.5), (-1, 0.0), (-2, -0.9999995), (-3, -0.5), (-4, -0.5), (1000012, 0.0), (123, 0.45600128), (100, 0.25), (102, 0.5), (0, 1.2e-3), (0, -1.2e-7), (17000, 0.0), (0, -1.7e-4), (0, 1.5e-7), (3, 0.14159274)]
[(0, 0.0), (0, 0.0), (1, 0.100000024), (2, 0.79999995), (3, 0.5), (4, 0.5), (-1, 0.0), (-2, -0.9999995), (-3, -0.5), (-4, -0.5), (1000012, 0.0), (123, 0.45600128), (100, 0.25), (102, 0.5), (0, 1.2e-3), (0, -1.2e-7), (17000, 0.0), (0, -1.7e-4), (0, 1.5e-7), (3, 0.14159274)]
[(0, 0.0), (0, 0.0), (1, 0.10000000000000009), (2, 0.7999999999999998), (3, 0.5), (4, 0.5), (-1, -1.000000082740371e-10), (-2, -0.9999994999999999), (-3, -0.50000000001), (-4, -0.49999999999), (1000012, 0.0), (123, 0.45600000000000307), (100, 0.25), (102, 0.5), (0, 1.2e-3), (0, -1.2e-7), (17000, 0.0), (0, -1.7e-4), (0, 1.5e-7), (3, 0.14159265358979312)]
[(0, 0.0), (0, 0.0), (1, 0.10000000000000009), (2, 0.7999999999999998), (3, 0.5), (4, 0.5), (-1, -1.000000082740371e-10), (-2, -0.9999994999999999), (-3, -0.50000000001), (-4, -0.49999999999), (1000012, 0.0), (123, 0.45600000000000307), (100, 0.25), (102, 0.5), (0, 1.2e-3), (0, -1.2e-7), (17000, 0.0), (0, -1.7e-4), (0, 1.5e-7), (3, 0.14159265358979312)]
[0.0, -0.0, 1.1, 2.8, 3.5, 4.5, -1.0, -2.9999995, -3.5, -4.5, 1000012.0, 123.456, 100.25, 102.5, 1.2e-3, -1.2e-7, 17000.0, -1.7e-4, 1.5e-7, 3.1415927, 1.18088e11, 1.2111e14]
[0.0, -0.0, 1.1, 2.8, 3.5, 4.5, -1.0000000001, -2.9999995, -3.50000000001, -4.49999999999, 1000012.0, 123.456, 100.25, 102.5, 1.2e-3, -1.2e-7, 17000.0, -1.7e-4, 1.5e-7, 3.141592653589793, 1.18088e11, 1.2111e14]
[0, 0, 2, 3, 4, 5, -1, -2, -3, -4, 1000012, 124, 101, 103, 1, 0, 17000, 0, 1, 4, 2123882496, 511705088]
[0, 0, 2, 3, 4, 5, -1, -2, -3, -4, 1000012, 124, 101, 103, 1, 0, 17000, 0, 1, 4, 118087999488, 121109999517696]
[0, 0, 2, 3, 4, 5, -1, -2, -3, -4, 1000012, 124, 101, 103, 1, 0, 17000, 0, 1, 4, 2123883008, 512187392]
[0, 0, 2, 3, 4, 5, -1, -2, -3, -4, 1000012, 124, 101, 103, 1, 0, 17000, 0, 1, 4, 118088000000, 121110000000000]
[0, 0, 1, 2, 3, 4, -1, -3, -4, -5, 1000012, 123, 100, 102, 0, -1, 17000, -1, 0, 3, 2123882496, 511705088]
[0, 0, 1, 2, 3, 4, -1, -3, -4, -5, 1000012, 123, 100, 102, 0, -1, 17000, -1, 0, 3, 118087999488, 121109999517696]
[0, 0, 1, 2, 3, 4, -2, -3, -4, -5, 1000012, 123, 100, 102, 0, -1, 17000, -1, 0, 3, 2123883008, 512187392]
[0, 0, 1, 2, 3, 4, -2, -3, -4, -5, 1000012, 123, 100, 102, 0, -1, 17000, -1, 0, 3, 118088000000, 121110000000000]
[0, 0, 1, 2, 3, 4, -1, -2, -3, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3, 2123882496, 511705088]
[0, 0, 1, 2, 3, 4, -1, -2, -3, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3, 118087999488, 121109999517696]
[0, 0, 1, 2, 3, 4, -1, -2, -3, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3, 2123883008, 512187392]
[0, 0, 1, 2, 3, 4, -1, -2, -3, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3, 118088000000, 121110000000000]
[0, 0, 1, 3, 4, 4, -1, -3, -4, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3, 2123882496, 511705088]
[0, 0, 1, 3, 4, 4, -1, -3, -4, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3, 118087999488, 121109999517696]
[0, 0, 1, 3, 4, 4, -1, -3, -4, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3, 2123883008, 512187392]
[0, 0, 1, 3, 4, 4, -1, -3, -4, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3, 118088000000, 121110000000000]
[(0, 0.0), (0, 0.0), (1, 0.100000024), (2, 0.79999995), (3, 0.5), (4, 0.5), (-1, 0.0), (-2, -0.9999995), (-3, -0.5), (-4, -0.5), (1000012, 0.0), (123, 0.45600128), (100, 0.25), (102, 0.5), (0, 1.2e-3), (0, -1.2e-7), (17000, 0.0), (0, -1.7e-4), (0, 1.5e-7), (3, 0.14159274), (2123882496, 0.0), (511705088, 0.0)]
[(0, 0.0), (0, 0.0), (1, 0.100000024), (2, 0.79999995), (3, 0.5), (4, 0.5), (-1, 0.0), (-2, -0.9999995), (-3, -0.5), (-4, -0.5), (1000012, 0.0), (123, 0.45600128), (100, 0.25), (102, 0.5), (0, 1.2e-3), (0, -1.2e-7), (17000, 0.0), (0, -1.7e-4), (0, 1.5e-7), (3, 0.14159274), (118087999488, 0.0), (121109999517696, 0.0)]
[(0, 0.0), (0, 0.0), (1, 0.10000000000000009), (2, 0.7999999999999998), (3, 0.5), (4, 0.5), (-1, -1.000000082740371e-10), (-2, -0.9999994999999999), (-3, -0.50000000001), (-4, -0.49999999999), (1000012, 0.0), (123, 0.45600000000000307), (100, 0.25), (102, 0.5), (0, 1.2e-3), (0, -1.2e-7), (17000, 0.0), (0, -1.7e-4), (0, 1.5e-7), (3, 0.14159265358979312), (2123883008, 0.0), (512187392, 0.0)]
[(0, 0.0), (0, 0.0), (1, 0.10000000000000009), (2, 0.7999999999999998), (3, 0.5), (4, 0.5), (-1, -1.000000082740371e-10), (-2, -0.9999994999999999), (-3, -0.50000000001), (-4, -0.49999999999), (1000012, 0.0), (123, 0.45600000000000307), (100, 0.25), (102, 0.5), (0, 1.2e-3), (0, -1.2e-7), (17000, 0.0), (0, -1.7e-4), (0, 1.5e-7), (3, 0.14159265358979312), (118088000000, 0.0), (121110000000000, 0.0)]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment