eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Integer':

Home

everywhere
www.exept.de
for:
[back]

Class: Integer


Inheritance:

   Object
   |
   +--Magnitude
      |
      +--ArithmeticValue
         |
         +--Number
            |
            +--Integer
               |
               +--LargeInteger
               |
               +--SmallInteger

Package:
stx:libbasic
Category:
Magnitude-Numbers
Version:
rev: 1.246 date: 2010/04/13 16:11:42
user: cg
file: Integer.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Claus Gittinger

Description:


abstract superclass for all integer numbers.
See details in concrete subclasses LargeInteger and SmallInteger.

Mixed mode arithmetic:
    int op int         -> int
    int op fix         -> fix; scale is fix's scale
    int op fraction    -> fraction
    int op float       -> float

[Class variables:]

    DefaultDisplayRadix     the radix in which integers present their
                            displayString (which is used in inspectors)
                            If you are to look at many hex numbers, bitmasks
                            etc. you may set this to 2 or 16.
                            (avoids typing printStringRadix:.. all the time
                             - I know - I am lazy ;-). Default is 10.


Related information:

    Number
    LargeInteger
    SmallInteger
    Float
    ShortFloat
    Fraction
    FixedPoint

Class protocol:

Compatibility-Squeak
o  readFrom: aStringOrStream base: aBase
for squeak compatibility

Signal constants
o  bcdConversionErrorSignal
return the signal which is raised when bcd conversion fails
(i.e. when trying to decode an invalid BCD number)

class initialization
o  initialize

constants
o  epsilon
return the maximum relative spacing

o  unity
return the neutral element for multiplication (1)

o  zero
return the neutral element for addition (0)

instance creation
o  byte1: b1 byte2: b2 byte3: b3 byte4: b4
Squeak compatibility:
Return an Integer given four value bytes.
The returned integer is either a Small- or a LargeInteger

o  fastFromString: aString at: startIndex
return the next unsigned Integer from the string
as a decimal number, starting at startIndex.
The number must be in the native machines int range
(i.e. 63bit on alpha / 31 on all others);
However, for portability, only use it for 31bit numbers.
No spaces are skipped.

This is a specially tuned entry (using a low-level C-call), which
returns garbage if the argument string is not a small integer number.
It has been added to allow high speed string decomposition into numbers,
especially for mass-data.

o  fromBCDBytes: aByteArray
given a byteArray in BCD format, return an appropriate integer.
The byteArray must contain the BCD encoded decimal string,
starting with the most significant digits.
This conversion is useful for some communication protocols,
or control systems, which represent big numbers this way...

o  fromSwappedBCDBytes: aByteArray
given a byteArray in BCD format, return an appropriate integer.
The byteArray must contain the BCD encoded decimal string,
starting with the LEAST significant digits.
This conversion is useful for some communication protocols,
or control systems (e.g. SMC), which represent big numbers this way...

o  new: numberOfBytes neg: negative
for ST-80 compatibility:
Return an empty Integer (uninitialized value) with space for
numberOfBytes bytes (= digitLength). The additional argument
negative specifies if the result should be a negative number.
The digits can be stored byte-wise into the result, using digitAt:put:

o  readFrom: aStringOrStream
return the next unsigned Integer from the (character-)stream aStream
as decimal number.

NOTICE:
This behaves different from the default readFrom:, in returning
0 (instead of raising an error) in case no number can be read.
It is unclear, if this is the correct behavior (ST-80 does this)
- depending on the upcoming ANSI standard, this may change.

o  readFrom: aStringOrStream onError: exceptionBlock
return the next Integer from the (character-)stream aStream,
handling initial XXr for arbitrary radix numbers and initial sign.
Also, all initial whitespace is skipped.
If the string does not represent a valid integer number,
return the value of exceptionBlock.

o  readFrom: aStringOrStream radix: radix
return the next unsigned Integer from the (character-)stream aStream
in radix; (assumes that the initial XXr has already been read).
No whitespace-skipping is done.
Returns 0 if no number available.

NOTICE:
This behaves different from the default readFrom:, in returning
0 (instead of raising an error) in case no number can be read.
It is unclear, if this is the correct behavior (ST-80 does this)
- depending on the upcoming ANSI standard, this may change.

o  readFrom: aStringOrStream radix: radix onError: exceptionBlock
return the next unsigned Integer from the (character-)stream aStream
in radix; (assumes that the initial XXr has already been read).
No whitespace-skipping is done.
Returns the value of exceptionBlock, if no number is available.

o  readFromRomanString: aStringOrStream
convert a string or stream containing a roman representation into an integer.
Raises a RomanNumberFormatError, if the inputs format is completely wrong.
Raises BadRomanNumberFormatError if its wrong, but could be parsed.
Notifies via NaiveRomanNumberFormatNotification, if its a bit wrong (naive format).
Will read both real and naive roman numbers (see printRomanOn: vs. printRomanOn:naive:),
however, a notification is raised for for naive numbers (catch it if you are interested in it).

o  readFromRomanString: aStringOrStream onError: exceptionalValue
convert a string or stream containing a roman representation into an integer.
Raises an exception, if the inputs format is wrong.
Does allow reading of naive (more than 3 in a row) and
bad (not using L and D) roman numbers.
(Such numbers can be seen on some medevial buildings.

o  readFromString: aString radix: base onError: exceptionBlock

misc
o  displayRadix: aNumber
being tired of always sending #printStringRadix: in the inspectors,
this allows you to change the default print radix for the displayString
method.

prime numbers
o  flushPrimeCache
cleanup after using a primeCache

o  initializePrimeCacheUpTo: limit
if many operations are to be done using primes, we can keep them around...
You will need n/8/2 bytes to keep fast info about primes up to n
(i.e. 100Mb is good for primes up to 1.6*10^9)

o  largePrimesUpTo: max do: aBlock
Evaluate aBlock with all primes up and including maxValue.
The Algorithm is adapted from http://www.rsok.com/~jrm/printprimes.html
It encodes prime numbers much more compactly than #primesUpTo:
38.5 integer per byte (2310 numbers per 60 byte) allow for some fun large primes.
(all primes up to SmallInteger maxVal can be computed within ~27MB of memory;
the regular #primesUpTo: would require 4 *GIGA*bytes).
Note: The algorithm could be re-written to produce the first primes (which require
the longest time to sieve) faster but only at the cost of clarity.

o  primeCacheSize

o  primesUpTo2000
primes up to 1000

o  primesUpTo: max
Return a list of prime integers up to abd including the given integer.

o  primesUpTo: max do: aBlock
Compute aBlock with all prime integers up to and including the given integer.

queries
o  hasSharedInstances
return true if this class has shared instances, that is, instances
with the same value are identical.
Although not always shared (LargeIntegers), these should be treated
so, to be independent of the number of bits in a SmallInt

o  isAbstract
Return if this class is an abstract class.
True is returned for Integer here; false for subclasses.
Abstract subclasses must redefine again.


Instance protocol:

Compatibility-Dolphin
o  & aNumber
return the bitwise-and of the receiver and the argument, anInteger.
Same as bitAnd: - added for compatibility with Dolphin Smalltalk

o  highWord
return the high 16 bits of a 32 bit value

o  lowWord
return the low 16 bits of a 32 bit value

o  mask: integerMask set: aBoolean
Answer the result of setting/resetting the specified mask in the receiver.

o  printStringRadix: aRadix padTo: sz
return a printed representation of the receiver in a given radix,
padded with spaces (at the right) up to size.
If the printString is longer than size,
it is returned unchanged (i.e. not truncated).
See also printStringRadix:size:fill:

o  | aNumber
return the bitwise-or of the receiver and the argument, anInteger.
Same as bitOr: - added for compatibility with Dolphin Smalltalk

Compatibility-Squeak
o  asByteArray
return my hexBytes in MSB

o  asByteArrayOfSize: size
return my hexBytes in MSB, optionally padded at the left with zeros

o  atRandom
return a random number between 1 amd myself

o  atRandom: aRandomGenerator
return a random number between 1 amd myself

o  printPaddedWith: padChar to: size base: base

o  printStringBase: base
return my printString in a base;
same as printStringRadix:

o  printStringHex
return my printString in base 16;
same as printStringRadix:

o  printStringRoman
return my roman printString;
almost the same as romanPrintString:

o  raisedTo: exp modulo: mod

Compatibility-V'Age
o  << aNumber
V'Age compatibility: left shift

o  >> aNumber
V'Age compatibility: right shift

bcd conversion
o  decodeFromBCD
return a number representing the value of the BCD encoded receiver.

o  encodeAsBCD
return a BCD encoded number representing the same value as the
receiver.

bit operators
o  allMask: anInteger
return true if all 1-bits in anInteger are also 1 in the receiver

o  anyMask: anInteger
return true if any 1-bits in anInteger is also 1 in the receiver.
(somewhat incorrect, if the mask is zero)

o  bitAnd: anInteger
return the bitwise-and of the receiver and the argument, anInteger.
This is a general and slow implementation, walking over the bytes of
the receiver and the argument.

o  bitAt: index
return the value of the index's bit (index starts at 1) as 0 or 1.
Notice: the result of bitAt: on negative receivers is not
defined in the language standard (since the implementation
is free to choose any internal representation for integers)

o  bitClear: anInteger
return the bitwise-and of the receiver and the complement of argument, anInteger.
This is a general and slow implementation, walking over the bytes of
the receiver and the argument.

o  bitCount
return the number of 1-bits in the receiver

o  bitIndicesOfOneBitsDo: aBlock
evaluate aBlock for all indices of a 1-bit, starting with the index of the lowest bit.
The index for the least significant bit is 1.

o  bitIndicesOfOneBitsReverseDo: aBlock
evaluate aBlock for all inices of a 1-bit, starting with the index of the highest
and ending with the lowest bit.
The index for the least significant bit is 1.

o  bitInvert
return a new integer, where all bits are complemented.
This does not really make sense for negative largeIntegers,
since the digits are stored as absolute value.
Q: is this specified in a language standard ?

o  bitOr: anInteger
return the bitwise-or of the receiver and the argument, anInteger.
This is a general and slow implementation, walking over the bytes of
the receiver and the argument.

o  bitShift: shiftCount
return the value of the receiver shifted by shiftCount bits;
leftShift if shiftCount > 0; rightShift otherwise.

Notice: the result of bitShift: on negative receivers is not
defined in the language standard (since the implementation
is free to choose any internal representation for integers)
However, ST/X preserves the sign.

o  bitTest: anInteger
return true, if any bit from aMask is set in the receiver.
I.e. true, if the bitwise-AND of the receiver and the argument, anInteger
is non-0, false otherwise.
This is a general and slow implementation, walking over the bytes of
the receiver and the argument.

o  bitXor: anInteger
return the bitwise-or of the receiver and the argument, anInteger.
This is a general and slow implementation, walking over the bytes of
the receiver and the argument.

o  changeBit: index to: aBooleanOrNumber
return a new number where the specified bit is on or off,
depending on aBooleanOrNumber.
Bits are counted from 1 starting with the least significant.
The methods name may be missleading: the receiver is not changed,
but a new number is returned. Should be named #withBit:changedTo:

o  changeMask: mask to: aBooleanOrNumber
return a new number where the specified mask-bit is on or off,
depending on aBooleanOrNumber.
The methods name may be missleading: the receiver is not changed,
but a new number is returned. Should be named #withMask:changedTo:

o  clearBit: index
return a new integer where the specified bit is off.
Bits are counted from 1 starting with the least significant.
The methods name may be missleading: the receiver is not changed,
but a new number is returned. Should be named #withBitCleared:

o  even
return true if the receiver is even

o  highBit
return the bitIndex of the highest bit set. The returned bitIndex
starts at 1 for the least significant bit.
Returns 0 if no bit is set.

o  invertBit: index
return a new number where the specified bit is inverted.
Bits are counted from 1 starting with the least significant.
The methods name may be missleading: the receiver is not changed,
but a new number is returned. Should be named #withBitInverted:

o  isBitSet: index
return true if the index' bit is set; false otherwise.
Bits are counted from 1 starting with the least significant.

o  lowBit
return the bitIndex of the lowest bit set. The returned bitIndex
starts at 1 for the least significant bit.
Returns 0 if no bit is set.

o  maskClear: aMask

o  maskSet: aMask

o  noMask: anInteger
return true if no 1-bit in anInteger is 1 in the receiver

o  odd
return true if the receiver is odd

o  rightShift: shiftCount
return the value of the receiver shifted right by shiftCount bits;
rightShift if shiftCount > 0; leftShift otherwise.

Notice: the result of bitShift: on negative receivers is not
defined in the language standard (since the implementation
is free to choose any internal representation for integers)
However, ST/X preserves the sign.

o  setBit: index
return a new integer, where the specified bit is on.
Bits are counted from 1 starting with the least significant.
The methods name may be missleading: the receiver is not changed,
but a new number is returned. Should be named #withBitSet:

byte access
o  byteAt: anIndex
compatibility with ByteArrays etc.

o  digitByteLength
return the number bytes required for a 2's complement
binary representation of this Integer.
For positive receivers, thats the same as the digitLength.

o  digitBytes
return a byteArray filled with the receivers bits
(8 bits of the absolute value per element),
least significant byte is first

** This method raises an error - it must be redefined in concrete classes **

o  digitBytesMSB: msbFlag
return a byteArray filled with the receivers bits
(8 bits of the absolute value per element),
if msbflag = true, most significant byte is first,
otherwise least significant byte is first

coercing & converting
o  asFixedPoint
return the receiver as a fixedPoint number

o  asFixedPoint: scale
return the receiver as fixedPoint number, with the given number
of post-decimal-point digits.

o  asFloat
return a Float with same value as myself.
Since floats have a limited precision, you usually loose bits when doing this.

o  asFraction
return a Fraction with same value as receiver

o  asInteger
return the receiver truncated towards zero -
for integers this is self

o  asLargeFloat
return a LargeFloat with same value as myself.
Since largeFloats have a limited precision, you usually loose bits when
doing this.

o  asLongFloat
return a LongFloat with same value as myself.
Since longFloats have a limited precision, you usually loose bits when
doing this.

o  asModuloNumber
return a precomputed modulo number

o  asShortFloat
return a ShortFloat with same value as receiver

o  signExtendedByteValue
return a smallInteger from sign-extending the 8'th bit.
May be useful for communication interfaces

o  signExtendedShortValue
return a smallInteger from sign-extending the 16'th bit.
May be useful for communication interfaces

comparing
o  hash
redefined to return smallInteger hashValues

double dispatching
o  differenceFromFraction: aFraction
sent when a fraction does not know how to subtract the receiver, an integer

o  differenceFromTimestamp: aTimestamp
I am to be interpreted as seconds, return the timestamp this number of seconds
before aTimestamp

o  equalFromFraction: aFraction
that should never be invoked, as fractions are always normalized to integers
if resulting from an arithmetic operation.
However, this implementation is for subclasses (i.e. fixed point) and also
allows comparing unnormalized fractions as might appear within the fraction class

o  productFromFraction: aFraction
sent when a fraction does not know how to multiply the receiver, an integer

o  quotientFromFraction: aFraction
Return the quotient of the argument, aFraction and the receiver.
Sent when aFraction does not know how to divide by the receiver.

o  sumFromFraction: aFraction
sent when a fraction does not know how to add the receiver, an integer

o  sumFromTimestamp: aTimestamp
I am to be interpreted as seconds, return the timestamp this number of seconds
after aTimestamp

helpers
o  gcd_helper: anInteger
a helper for the greatest common divisor of the receiver and anInteger.
Knuth's algorithm for large positive integers, with receiver being
larger than the arg.

inspecting
o  inspectorExtraAttributes
extra (pseudo instvar) entries to be shown in an inspector.

iteration
o  to: stop collect: aBlock
syntactic sugar;
same as (self to:stop) collect:aBlock

misc math
o  acker: n
return the value of acker(self, n).
;-) Do not try with receivers > 3

o  binco: kIn

o  binomialCoefficient: kIn
The binomial coefficient

/ n \ with self being n, and 0 <= k <= n.
\ k /

is the number of ways of picking k unordered outcomes from n possibilities,
also known as a combination or combinatorial number.
Sometimes also called C(n,k) (for choose k from n)

binCo is defined as:
n!
----------
k! (n-k)!

but there is a faster, recursive formula:

/ n \ = / n - 1 \ + / n - 1 \
\ k / \ k - 1 / \ k /

with:

/ n \ = / n \ = 1
\ 0 / \ n /

o  divMod: aNumber
return an array filled with self // aNumber and
self \\ aNumber.
The result is only defined for positive receiver and argument.
This may be redefined in some integer classes for
more performance (where the remainder is generated as a side effect of division)

o  extendedEuclid: tb
return the solution of 'ax + by = gcd(a,b)'.
An array containing x, y and gcd(a,b) is returned.

o  factorial
return fac(self) (i.e. 1*2*3...*self) using an iterative algorithm.
This is slightly faster than the recursive algorithm, and does not
suffer from stack overflow problems (with big receivers)

o  factorialR
return fac(self) (i.e. 1*2*3...*self) using a recursive algorithm.

This is included to demonstration purposes - if you really need
factorial numbers, use the iterative #factorial, which is slightly
faster and does not suffer from stack overflow problems (with big receivers).

o  fib
compute the fibionacci number for the receiver.
fib(0) := 0
fib(1) := 1
fib(n) := fib(n-1) + fib(n-2)

o  fib_helper
compute the fibionacci number for the receiver.

Fib(n) = Fib(n-1) + Fib(n-2)

Knuth:
Fib(n+m) = Fib(m) * Fib(n+1) + Fib(m-1) * Fib(n)

This is about 3 times faster than fib_iterative.

o  gcd: anInteger
return the greatest common divisor of the receiver and anInteger.
Euclids & Knuths algorithm.

o  integerReciprocal
return an integer representing 1/self * 2**n.
Where an integer is one bit longer than self.
This is a helper for modulu numbers

o  integerSqrt
newton's method to get the largest integer which is less or equal to the
receiver's square root.
This might be needed for some number theoretic problems with large numbers
(ans also in cryptography)

o  inverseMod: n
find the modular inverse for myself to n.
This is defined as the solution of: '1 = (self * x) mod n.
This is a helper for modulu numbers

o  lcm: anInteger
return the least common multiple (using gcd:)

o  primeFactors
return a collection of prime factors of the receiver.
For prime numbers, an empty collection is returned.
Can take a long time for big numbers
(win a nobel price, if you find something quick)

o  primeFactorsUpTo: limitArgOrNil
return a collection of prime factors of the receiver.
For prime numbers, an empty collection is returned.
Can take a long time for big numbers
(win a nobel price, if you find something quick)

o  raisedTo: exp mod: mod
return the modulo (remainder) of
the receiver raised to exp (an Integer) and mod (another Integer)

o  raisedToCrtModP: p q: q ep: ep eq: eq u: u
Application of the Chinese Remainder Theorem (CRT).

This is a faster modexp for moduli with a known factorisation into two
relatively prime factors p and q, and an input relatively prime to the
modulus, the Chinese Remainder Theorem to do the computation mod p and
mod q, and then combine the results. This relies on a number of
precomputed values, but does not actually require the modulus n or the
exponent e.

expout = expin ^ e mod (p*q).
We form this by evaluating
p2 = (expin ^ e) mod p and
q2 = (expin ^ e) mod q
and then combining the two by the CRT.

Two optimisations of this are possible. First, we can reduce expin
modulo p and q before starting.

Second, since we know the factorisation of p and q (trivially derived
from the factorisation of n = p*q), and expin is relatively prime to
both p and q, we can use Euler's theorem, expin^phi(m) = 1 (mod m),
to throw away multiples of phi(p) or phi(q) in e.
Letting ep = e mod phi(p) and
eq = e mod phi(q)
then combining these two speedups, we only need to evaluate
p2 = ((expin mod p) ^ ep) mod p and
q2 = ((expin mod q) ^ eq) mod q.

Now we need to apply the CRT. Starting with
expout = p2 (mod p) and
expout = q2 (mod q)
we can say that expout = p2 + p * k, and if we assume that 0 <= p2 < p,
then 0 <= expout < p*q for some 0 <= k < q. Since we want expout = q2
(mod q), then p*k = q2-p2 (mod q). Since p and q are relatively prime,
p has a multiplicative inverse u mod q. In other words, u = 1/p (mod q).

Multiplying by u on both sides gives k = u*(q2-p2) (mod q).
Since we want 0 <= k < q, we can thus find k as
k = (u * (q2-p2)) mod q.

Once we have k, evaluating p2 + p * k is easy, and
that gives us the result

printing & storing
o  asBCDBytes
return a byteArray containing the receiver in BCD encoding.
The byteArray will contain the BCD encoded decimal string,
starting with the most significant digits first.
This conversion is useful for some communication protocols,
or control systems, which represent big numbers this way...

o  displayString
return a string for displaying in a view (as in inspector).
The output radix is usually 10, but can be changed by setting
DefaultDisplayRadix (see Integer>>displayRadix:)

o  errorPrintHex
print the receiver as a hex number on the standard error stream

o  hexPrintString
return a hex string representation of the receiver

o  hexPrintString: size
return a hex string representation of the receiver,
padded to size characters

o  printHex
print the receiver as a hex number on the standard output stream

o  printOn: aStream
append a printed description of the receiver to aStream

o  printOn: aStream base: b
return a string representation of the receiver in the specified
radix (without the initial XXr)

o  printOn: aStream base: b showRadix: showRadix
append a string representation of the receiver in the specified numberBase to aStream
(if showRadix is true, with initial XXr)
The radix argument should be between 2 and 36.

o  printOn: aStream base: baseInteger size: sz fill: fillCharacter
print a string representation of the receiver in the specified
base. The string is padded on the left with fillCharacter to make
its size as specified in sz.

o  printOn: aStream radix: base
append a printed description of the receiver to aStream.
The receiver is printed in radix base (instead of the default, 10).
This method is obsoleted by #printOn:base:, which is ST-80 & ANSI compatible.

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  printRomanOn: aStream
print the receiver as roman number to the receiver, aStream.
This converts correct (i.e. prefix notation for 4,9,40,90, etc.).

o  printRomanOn: aStream naive: naive
print the receiver as roman number to the receiver, aStream.
The naive argument controls if the conversion is
correct (i.e. subtracting prefix notation for 4,9,40,90, etc.),
or naive (i.e. print 4 as IIII and 9 as VIIII); also called simple.
The naive version is often used for page numbers in documents.

o  printStringRadix: base
return a string representation of the receiver in the specified
base; does NOT prepend XXr to the string.
See also: radixPrintStringRadix:
printOn:base:showRadix:

o  printStringRadix: aRadix size: sz fill: fillCharacter
return a string representation of the receiver in the specified
radix. The string is padded on the left with fillCharacter to make
its size as specified in sz.

o  radixPrintStringRadix: radix
return a string representation of the receiver in the specified
base; prepend XXr to the string

o  romanPrintString
return a roman number representation of the receiver as a string

queries
o  digitAt: n
return the n-th byte of the binary representation.

** This method raises an error - it must be redefined in concrete classes **

o  digitByteAt: n
return 8 bits of my signed value, starting at byte index.
For positive receivers, this is the same as #digitAt:;
for negative ones, the actual bit representation is returned.

** This method raises an error - it must be redefined in concrete classes **

o  digitLength
return the number of bytes needed for the binary representation
of the receiver.
This method is redefined in concrete classes - the fallback here is
never really used.

o  isInteger
return true, if the receiver is some kind of integer number

o  isPowerOf: p
return true, if the receiver is a power of p

o  isPowerOfTwo
return true, if the receiver is a power of 2

special access
o  exponent
return what would be the normalized float's exponent if I were a float.
This is not for general use - it has been added for dolphin (soap) compatibility.
This assumes that the mantissa is normalized to
0.5 .. 1.0 and the number's value is: mantissa * 2^exp

special bit operators
o  add_32: anInteger
return a C-semantic 32bit sum of the receiver and the argument.
Both must be either Small- or LargeIntegers.
Returns a signed 32bit number.
This (nonstandard) specialized method is provided to allow simulation of
modulu operations with C semantics.

o  add_32u: anInteger
return a C-semantic 32bit unsigned sum of the receiver and the argument.
Both must be either Small- or LargeIntegers.
Returns an unsigned 32bit number.
This (nonstandard) specialized method is provided to allow simulation of
modulu operations with C semantics.

o  bitAnd_32: anInteger
return a C-semantic 32bit locical-and of the receiver and
the argument. Both must be either Small- or LargeIntegers.
Returns a signed 32bit number.
This (nonstandard) specialized method is provided to allow simulation of
bit operations with C semantics.

o  bitAnd_32u: anInteger
return a C-semantic 32bit locical-and of the receiver and
the argument. Both must be either Small- or LargeIntegers.
Returns an unsigned 32bit number.
This (nonstandard) specialized method is provided to allow simulation of
bit operations with C semantics.

o  bitInvert_32
return a C-semantic 32bit complement of the receiver,
which must be either Small- or LargeIntegers.
Returns a signed 32bit number.
This (nonstandard) specialized method is provided to allow simulation of
bit operations with C semantics.

o  bitInvert_32u
return a C-semantic 32bit complement of the receiver,
which must be either Small- or LargeIntegers.
Returns an unsigned 32bit number.
This (nonstandard) specialized method is provided to allow simulation of
bit operations with C semantics.

o  bitOr_32: anInteger
return a C-semantic 32bit locical-or of the receiver and
the argument. Both must be either Small- or LargeIntegers.
Returns a signed 32bit number.
This (nonstandard) specialized method is provided to allow simulation of
bit operations with C semantics.

o  bitOr_32u: anInteger
return a C-semantic 32bit locical-or of the receiver and
the argument. Both must be either Small- or LargeIntegers.
Returns an unsigned 32bit number.
This (nonstandard) specialized method is provided to allow simulation of
bit operations with C semantics.

o  bitXor_32: anInteger
return a C-semantic 32bit locical-xor of the receiver and
the argument. Both must be either Small- or LargeIntegers.
Returns a signed 32bit number.
This (nonstandard) specialized method is provided to allow simulation of
bit operations with C semantics.

o  bitXor_32u: anInteger
return a C-semantic 32bit locical-xor of the receiver and
the argument. Both must be either Small- or LargeIntegers.
Returns an unsigned 32bit number.
This (nonstandard) specialized method is provided to allow simulation of
bit operations with C semantics.

o  mul_32: anInteger
return a C-semantic 32bit product of the receiver and the argument.
Both must be either Small- or LargeIntegers.
Returns a signed 32bit number.
This (nonstandard) specialized method is provided to allow simulation of
modulu operations with C semantics.

o  mul_32u: anInteger
return a C-semantic 32bit unsigned product of the receiver and the argument.
Both must be either Small- or LargeIntegers.
Returns an unsigned 32bit number.
This (nonstandard) specialized method is provided to allow simulation of
modulu operations with C semantics.

o  sub_32: anInteger
return a C-semantic 32bit difference of the receiver and the argument.
Both must be either Small- or LargeIntegers.
Returns a signed 32bit number.
This (nonstandard) specialized method is provided to allow simulation of
modulu operations with C semantics.

o  sub_32u: anInteger
return a C-semantic 32bit unsigned difference of the receiver and the argument.
Both must be either Small- or LargeIntegers.
Returns an unsigned 32bit number.
This (nonstandard) specialized method is provided to allow simulation of
modulu operations with C semantics.

testing
o  isLiteral
return true, if the receiver can be used as a literal constant in ST syntax
(i.e. can be used in constant arrays)

o  isPrime
return true if I am a prime Number.
This is a q&d hack, which may need optimization if heavily used.

o  nextPrime
return the next prime after the receiver

tracing
o  traceInto: aRequestor level: level from: referrer
double dispatch into tracer, passing my type implicitely in the selector

truncation & rounding
o  ceiling
return the smallest integer which is larger or equal to the receiver.
For integers, this is the receiver itself.

o  compressed
if the receiver can be represented as a SmallInteger, return
a SmallInteger with my value; otherwise return self with leading
zeros removed. This method is redefined in LargeInteger.

o  floor
return the largest integer which is smaller or equal to the receiver.
For integers, this is the receiver itself.

o  fractionPart
return a number with value from digits after the decimal point.
(i.e. the receiver minus its truncated value)
Since integers have no fraction, return 0 here.

o  integerPart
return a number with value from digits before the decimal point.
(i.e. the receivers truncated value)
Since integers have no fraction, return the receiver here.

o  normalize
if the receiver can be represented as a SmallInteger, return
a SmallInteger with my value; otherwise return self with leading
zeros removed.
This method is left for backward compatibility - it has been
renamed to #compressed for ST-80 compatibility.

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  rounded
return the receiver rounded toward the next Integer -
for integers this is the receiver itself.

o  truncated
return the receiver truncated towards zero as Integer
for integers this is the receiver itself.

visiting
o  acceptVisitor: aVisitor with: aParameter


Private classes:

    ModuloNumber


ST/X 6.1.1; WebServer 1.620 at exept:8081; Wed, 23 May 2012 19:42:30 GMT