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
05d9b5ae
Commit
05d9b5ae
authored
25 years ago
by
Simon Marlow
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 2000-01-19 17:08:02 by simonmar]
- add some more test cases, now shows up the minInt bugs in Integer division.
parent
d6e5fc13
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ghc/tests/numeric/should_run/arith003.hs
+63
-10
63 additions, 10 deletions
ghc/tests/numeric/should_run/arith003.hs
with
63 additions
and
10 deletions
ghc/tests/numeric/should_run/arith003.hs
+
63
−
10
View file @
05d9b5ae
-- !!! test arithmetic operations from "Prelude" (gcd, l
d
m, etc.)
-- !!! test arithmetic operations from "Prelude" (gcd, l
c
m, etc.)
--
main
=
let
minInt
=
minBound
::
Int
maxInt
=
maxBound
::
Int
in
putStr
=
putStr
(
-- w/ Ints
show
[
minInt
,
maxInt
,
...
...
@@ -21,7 +17,7 @@ main
gcd
i8m
i0
,
gcd
i0
i8m
,
gcd
(
4070297
::
Int
)
(
2695911
::
Int
),
-- 52,861
lcm
i8
i6
,
lcm
i8m
i6
,
lcm
i8m
i6m
,
...
...
@@ -37,14 +33,31 @@ main
]
++
"
\n
"
++
show
[
quotRem
i8
i6
,
quotRem
i8m
i6
,
quotRem
i8m
i6m
,
-- quotRem i8m i0, -- no div by zero
quotRem
i0
i8m
,
quotRem
(
4070297
::
Int
)
(
2695911
::
Int
),
-- 52,861
divMod
i8
i6
,
divMod
i8m
i6
,
divMod
i8m
i6m
,
-- divMod i8m i0, -- no div by zero
divMod
i0
i8m
,
divMod
(
4070297
::
Int
)
(
2695911
::
Int
)
-- 52,861
]
++
"
\n
"
-- w/ Integers
++
show
[
toInteger
minInt
,
toInteger
maxInt
,
minIntI
,
maxInt
I
,
subtract
i8I
i4I
,
subtract
i8mI
i4I
,
subtract
(
toInteger
maxInt
)
i4I
,
subtract
i0I
(
toInteger
minInt
)
,
subtract
maxInt
I
i4I
,
subtract
i0I
minInt
I
,
gcd
i8I
i6I
,
gcd
i8mI
i6I
,
...
...
@@ -52,6 +65,10 @@ main
gcd
i8mI
i0I
,
gcd
i0I
i8mI
,
gcd
(
4070297
::
Integer
)
(
2695911
::
Integer
),
-- 52,861
gcd
minIntI
(
-
1
),
-- out of Int range
gcd
minIntI
(
1
),
gcd
(
-
1
)
minIntI
,
gcd
(
1
)
minIntI
,
lcm
i8I
i6I
,
lcm
i8mI
i6I
,
...
...
@@ -59,6 +76,10 @@ main
lcm
i8mI
i0I
,
lcm
i0I
i8mI
,
lcm
(
4070297
::
Integer
)
(
2695911
::
Integer
),
-- 207,585,147
lcm
minIntI
(
-
1
),
-- out of Int range
lcm
minIntI
(
1
),
lcm
(
-
1
)
minIntI
,
lcm
(
1
)
minIntI
,
i8I
^
i0I
,
i8mI
^
i4I
,
...
...
@@ -66,6 +87,32 @@ main
-- ToDo: more stuff
]
++
"
\n
"
++
show
[
quotRem
i8I
i6I
,
quotRem
i8mI
i6I
,
quotRem
i8mI
i6mI
,
-- quotRem i8mI i0I, -- no div by zero
quotRem
i0I
i8mI
,
quotRem
(
4070297
::
Integer
)
(
2695911
::
Integer
),
-- 52,861
quotRem
minIntI
(
-
1
),
-- out of Int range
quotRem
minIntI
(
1
),
quotRem
(
-
1
)
minIntI
,
quotRem
(
1
)
minIntI
,
divMod
i8I
i6I
,
divMod
i8mI
i6I
,
divMod
i8mI
i6mI
,
-- divMod i8mI i0I, -- no div by zero
divMod
i0I
i8mI
,
divMod
(
4070297
::
Integer
)
(
2695911
::
Integer
),
-- 52,861
divMod
minIntI
(
-
1
),
-- out of Int range
divMod
minIntI
(
1
),
divMod
(
-
1
)
minIntI
,
divMod
(
1
)
minIntI
]
++
"
\n
"
)
where
i0
,
i4
,
i4m
,
i6
,
i6m
,
i8
,
i8m
::
Int
...
...
@@ -85,3 +132,9 @@ main
i6mI
=
-
6
i8I
=
8
i8mI
=
-
8
minInt
=
minBound
::
Int
maxInt
=
maxBound
::
Int
minIntI
=
fromIntegral
minInt
::
Integer
maxIntI
=
fromIntegral
maxInt
::
Integer
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