IntInf
structureThe optional IntInf structure is one of the possible implementations of the INTEGER interface. In addition to the INTEGER operations, it provides some operations useful for programming with arbitrarily large integers (bignums). Note that operations in IntInf that return a value of type IntInf.int will never raise the Overflow exception.
signature INT_INF
structure IntInf
: INT_INF
include INTEGER
val divMod : (int * int) -> (int * int)
val quotRem : (int * int) -> (int * int)
val pow : (int * Int.int) -> int
val log2 : int -> Int.int
include INTEGER
divMod (i, j)
(i div j, i mod j)
, but is likely to be more efficient than computing both components separately. Raises Div if j = 0.
quotRem (i, j)
(i quot j, i rem j)
, but is likely to be more efficient than computing both components separately. Raises Div if j = 0.
pow (i, j)
0
; when j < 0 and i is zero, exception Domain is raised. We define that pow(0, 0)
is 1
.
log2 i
k
for which pow
(2, k) <= i. Raises Domain if i <= 0. Raises Overflow if the result is not representable as an Int.int.
If an implementation provides the IntInf structure, then the type LargeInt.int must be the same as IntInf.int type.
INTEGER, LargeInt
Last Modified April 11, 1996
Copyright © 1996 AT&T