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
f628f0a1
Commit
f628f0a1
authored
25 years ago
by
Simon Peyton Jones
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1999-08-17 15:39:38 by simonpj]
Fix (I hope) documentation of Integer
parent
01e93cef
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ghc/docs/users_guide/libraries.vsgml
+17
-17
17 additions, 17 deletions
ghc/docs/users_guide/libraries.vsgml
with
17 additions
and
17 deletions
ghc/docs/users_guide/libraries.vsgml
+
17
−
17
View file @
f628f0a1
%
% $Id: libraries.vsgml,v 1.
5
1999/0
2/22 10:22
:3
5
s
of
Exp $
% $Id: libraries.vsgml,v 1.
6
1999/0
8/17 15:39
:3
8
s
imonpj
Exp $
%
% GHC Prelude and Libraries.
%
...
...
@@ -118,7 +118,8 @@ data Addr = A# Addr#
data Word = W# Word#
data Float = F# Float#
data Double = D# Double#
data Integer = J# Int# Int# ByteArray#
data Integer = S# Int# -- small integers
| J# Int# ByteArray# -- large integers
module GHC -- all primops and primitive types.
</verb></tscreen>
...
...
@@ -408,37 +409,36 @@ decodeDouble# :: Double# -> PrelNum.ReturnIntAndGMP
We implement @Integers@ (arbitrary-precision integers) using the GNU
multiple-precision (GMP) package (version 2.0.2).
The data type for @Integer@ must mirror that for @MP_INT@ in @gmp.h@
The data type for @Integer@ is either a small integer,
represented by an @Int@, or a large integer represented
using the pieces requird by GMP's @MP_INT@ in @gmp.h@
(see @gmp.info@ in @ghc/includes/runtime/gmp@). It comes out as:
<tscreen><verb>
data Integer = J# Int# Int# ByteArray#
data Integer = S# Int# -- small integers
| J# Int# ByteArray# -- large integers
</verb></tscreen>
<nidx>Integer type</nidx>
So, @Integer@ is really just a ``pairing'' type for a particular
collection of primitive types.
The primitive ops to support @Integers@ use the ``pieces'' of the
The primitive ops to support large @Integers@ use the ``pieces'' of the
representation, and are as follows:
<tscreen><verb>
negateInteger# :: Int# ->
Int# ->
ByteArray# -> Integer
negateInteger# :: Int# -> ByteArray# -> Integer
{plus,minus,times}Integer# :: Int# ->
Int# ->
ByteArray#
-> Int# ->
Int# ->
ByteArray#
{plus,minus,times}Integer# :: Int# -> ByteArray#
-> Int# -> ByteArray#
-> Integer
cmpInteger# :: Int# ->
Int# ->
ByteArray#
-> Int# ->
Int# ->
ByteArray#
cmpInteger# :: Int# -> ByteArray#
-> Int# -> ByteArray#
-> Int# -- -1 for <; 0 for ==; +1 for >
divModInteger#, quotRemInteger#
:: Int# ->
Int# ->
ByteArray#
-> Int# ->
Int# ->
ByteArray#
:: Int# -> ByteArray#
-> Int# -> ByteArray#
-> PrelNum.Return2GMPs
integer2Int# :: Int# ->
Int# ->
ByteArray# -> Int#
integer2Int# :: Int# -> ByteArray# -> Int#
int2Integer# :: Int# -> Integer -- NB: no error-checking on these two!
word2Integer# :: Word# -> 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