Category: Language-Data types
Superclass: Integer
I represent a large integer, which has to be stored as a long sequence of bytes. I have methods to do arithmetics and comparisons, but I need some help from my children, LargePositiveInteger and LargeNegativeInteger, to speed them up a bit.

Method category index

accessing (instance)
arithmetic (instance)
bit operations (instance)
built-ins (instance)
coercion (instance)
disabled (instance)
primitive operations (instance)
testing (instance)

accessing (instance)

raisedToInteger: n
Return self raised to the anInteger-th power

top


arithmetic (instance)

* aNumber
Multiply aNumber and the receiver, answer the result

+ aNumber

Sum the receiver and aNumber, answer the result

- aNumber

Subtract aNumber from the receiver, answer the result

/ aNumber

Divide aNumber and the receiver, answer the result (an Integer or Fraction)

// aNumber

Divide aNumber and the receiver, answer the result truncated towards -infinity

\\ aNumber

Divide aNumber and the receiver, answer the remainder truncated towards -infinity

divExact: aNumber

Dividing receiver by arg assuming that the remainder is zero, and answer the result

estimatedLog

Answer an estimate of (self abs floorLog: 10)

negated

Answer the receiver's negated

quo: aNumber

Divide aNumber and the receiver, answer the result truncated towards 0

rem: aNumber

Divide aNumber and the receiver, answer the remainder truncated towards 0

top


bit operations (instance)

bitAnd: aNumber
Answer the receiver ANDed with aNumber

bitAt: aNumber

Answer the aNumber-th bit in the receiver, where the LSB is 1

bitInvert

Answer the receiver's 1's complement

bitOr: aNumber

Answer the receiver ORed with aNumber

bitShift: aNumber

Answer the receiver shifted by aNumber places

bitXor: aNumber

Answer the receiver XORed with aNumber

lowBit

Return the index of the lowest order 1 bit of the receiver.

top


built-ins (instance)

at: anIndex
Answer the anIndex-th byte in the receiver's representation

at: anIndex put: aNumber

Set the anIndex-th byte in the receiver's representation

digitAt: anIndex

Answer the index-th base-256 digit of the receiver (byte), expressed in two's complement

digitAt: anIndex put: aNumber

Set the anIndex-th base-256 digit in the receiver's representation

digitLength

Answer the number of base-256 digits in the receiver

hash

Answer an hash value for the receiver

primReplaceFrom: start to: stop with: replacementString startingAt: replaceStart

Private - Replace the characters from start to stop with new characters contained in replacementString (which, actually, can be any variable byte class), starting at the replaceStart location of replacementString

size

Answer the number of indexed instance variable in the receiver

top


coercion (instance)

asCNumber
Convert the receiver to a kind of number that is understood by the C call-out mechanism.

coerce: aNumber

Truncate the number; if needed, convert it to LargeInteger representation.

generality

Answer the receiver's generality

unity

Coerce 1 to the receiver's class

zero

Coerce 0 to the receiver's class

top


disabled (instance)

asObject
This method always fails. The number of OOPs is far less than the minimum number represented with a LargeInteger.

asObjectNoFail

Answer `nil'.

top


primitive operations (instance)

basicLeftShift: totalShift
Private - Left shift the receiver by aNumber places

basicRightShift: totalShift

Private - Right shift the receiver by 'shift' places

largeNegated

Private - Same as negated, but always answer a LargeInteger

top


testing (instance)

< aNumber
Answer whether the receiver is smaller than aNumber

<= aNumber

Answer whether the receiver is smaller than aNumber or equal to it

= aNumber

Answer whether the receiver and aNumber identify the same number.

> aNumber

Answer whether the receiver is greater than aNumber

>= aNumber

Answer whether the receiver is greater than aNumber or equal to it

~= aNumber

Answer whether the receiver and aNumber identify different numbers.

top