From f628f0a17e613cf7679aa105a2c868e084873ebe Mon Sep 17 00:00:00 2001 From: simonpj Date: Tue, 17 Aug 1999 15:39:38 +0000 Subject: [project @ 1999-08-17 15:39:38 by simonpj] Fix (I hope) documentation of Integer --- ghc/docs/users_guide/libraries.vsgml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'ghc') diff --git a/ghc/docs/users_guide/libraries.vsgml b/ghc/docs/users_guide/libraries.vsgml index bbe1f43ab9..4c48c37f18 100644 --- a/ghc/docs/users_guide/libraries.vsgml +++ b/ghc/docs/users_guide/libraries.vsgml @@ -1,5 +1,5 @@ % -% $Id: libraries.vsgml,v 1.5 1999/02/22 10:22:35 sof Exp $ +% $Id: libraries.vsgml,v 1.6 1999/08/17 15:39:38 simonpj 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. @@ -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: -data Integer = J# Int# Int# ByteArray# +data Integer = S# Int# -- small integers + | J# Int# ByteArray# -- large integers Integer type - -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: -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 -- cgit v1.2.1