class MUTABLE_BIG_INTEGER
Summary
Class invariant
Overview
creation features
  • from_integer (value: INTEGER_32)
    Create or initialize Current using value as an initializer.
  • from_integer_64 (value: INTEGER_64)
    Create or set Current using value as an initializer.
  • from_string (str: STRING)
    Create or initialize Current using value as an initializer.
  • copy (other: MUTABLE_BIG_INTEGER)
    Update current object using fields of object attached to other, so as to yield equal objects.
features
Creation / initialization from INTEGER_32 or INTEGER_64:
Creation / initialization from STRING:
  • from_string (str: STRING)
    Create or initialize Current using value as an initializer.
Conversion tool
  • force_to_real_64: REAL_64
    only a tool unsigned conversion *** require ou changer export ? *** (Dom Oct 4th 2004) ***
Addition:
  • add (other: MUTABLE_BIG_INTEGER)
    Add other into Current.
  • add_to (other: MUTABLE_BIG_INTEGER, res: MUTABLE_BIG_INTEGER)
    Add other and Current, and put the result in res.
  • add_integer (other: INTEGER_32)
    Add other into Current.
  • add_integer_64 (other: INTEGER_64)
    Add other into Current.
  • add_natural (other: MUTABLE_BIG_INTEGER)
    Same behavior as add, but this one works only when Current and other are both positive numbers and are both greater than zero.
Subtract:
To divide:
  • divide (other: MUTABLE_BIG_INTEGER)
    Put the the quotient of the Euclidian division of Current by other in Current.
  • mod (other: MUTABLE_BIG_INTEGER)
    Put the the remainder of the Euclidian division of Current by other in Current.
  • divide_with_remainder_to (other: MUTABLE_BIG_INTEGER, remainder: MUTABLE_BIG_INTEGER)
    Euclidian division.
  • remainder_with_quotient_to (other: MUTABLE_BIG_INTEGER, quotient: MUTABLE_BIG_INTEGER)
    Euclidian division.
  • divide_to (other: MUTABLE_BIG_INTEGER, quotient: MUTABLE_BIG_INTEGER, remainder: MUTABLE_BIG_INTEGER)
    Euclidian division.
  • shift_left (n: INTEGER_32)
    Shift bits of magnitude by n position left.
  • shift_right (n: INTEGER_32)
    Right shift Current n bits.
GCD
  • gcd (other: MUTABLE_BIG_INTEGER)
    Compute GCD of Current and other.
To multiply:
  • multiply (other: MUTABLE_BIG_INTEGER)
    Multiply Current by other.
  • multiply_to (other: MUTABLE_BIG_INTEGER, res: MUTABLE_BIG_INTEGER)
    Multiply the contents of Current and other and place the result in res.
  • multiply_integer (other: INTEGER_32, res: MUTABLE_BIG_INTEGER)
    Multiply the contents of Current and other and place the result in res.
to multiply
Comparison:
Printing:
Miscellaneous:
  • negate
    Negate the sign of Current.
  • abs
    Absolute value of Current.
  • sign: INTEGER_8
    Sign of Current (0 -1 or 1).
  • set_with_zero
  • hash_code: INTEGER_32
    The hash-code value of Current.
  • copy (other: MUTABLE_BIG_INTEGER)
    Update current object using fields of object attached to other, so as to yield equal objects.
  • swap_with (other: MUTABLE_BIG_INTEGER)
    Swap the value of Current with the value of other.
Implementation:
Implementation:
  • subtract_magnitude (other: MUTABLE_BIG_INTEGER)
    Subtract other from Current (The result is placed in Current) and change negative (the sign) if necessary.
  • subtract_magnitude_raw (other: MUTABLE_BIG_INTEGER)
    Subtract (raw) the storage of other from Current.
  • subtract_magnitude_raw_reverse (other: MUTABLE_BIG_INTEGER)
    Subtract (raw) the storage of Current from other and put it in Current.
  • subtract_magnitude_raw_truncated (other: MUTABLE_BIG_INTEGER)
    Subtract (raw) the storage of other from Current where other is truncated to the size of Current.
  • subtract_magnitude_raw_reverse_truncated (other: MUTABLE_BIG_INTEGER)
    Subtract (raw) the storage of Current from other and put it in Current, where other is truncated to the size of Current.
For printing
Tools for capacity:
  • infix "<=" (other: MUTABLE_BIG_INTEGER): BOOLEAN
    Is Current less than or equal other?
  • infix ">" (other: MUTABLE_BIG_INTEGER): BOOLEAN
    Is Current strictly greater than other?
  • infix ">=" (other: MUTABLE_BIG_INTEGER): BOOLEAN
    Is Current greater than or equal than other?
  • in_range (lower: MUTABLE_BIG_INTEGER, upper: MUTABLE_BIG_INTEGER): BOOLEAN
    Return True if Current is in range [lower..upper]
    See also min, max, compare.
  • compare (other: MUTABLE_BIG_INTEGER): INTEGER_32
    If current object equal to other, 0 if smaller, -1; if greater, 1.
  • three_way_comparison (other: MUTABLE_BIG_INTEGER): INTEGER_32
    If current object equal to other, 0 if smaller, -1; if greater, 1.
  • min (other: MUTABLE_BIG_INTEGER): MUTABLE_BIG_INTEGER
    Minimum of Current and other.
  • max (other: MUTABLE_BIG_INTEGER): MUTABLE_BIG_INTEGER
    Maximum of Current and other.
Maximum:
Minimum:
Bits:
from_integer (value: INTEGER_32)
effective procedure
Create or initialize Current using value as an initializer.
is_integer_32: BOOLEAN
effective function
Does Current fit on an INTEGER_32?
is_integer: BOOLEAN
effective function
to_integer_32: INTEGER_32
effective function
Convert Current as a 32 bit INTEGER.
to_integer: INTEGER_32
effective function
from_integer_64 (value: INTEGER_64)
effective procedure
Create or set Current using value as an initializer.
is_integer_64: BOOLEAN
effective function
Does Current fit on an INTEGER_64?
to_integer_64: INTEGER_64
effective function
Convert Current as a INTEGER_64.
from_string (str: STRING)
effective procedure
Create or initialize Current using value as an initializer.
force_to_real_64: REAL_64
effective function
only a tool unsigned conversion *** require ou changer export ? *** (Dom Oct 4th 2004) ***
from_native_array (na: NATIVE_ARRAY[INTEGER_32], cap: INTEGER_32, neg: BOOLEAN)
effective procedure
to_integer_general_number: INTEGER_GENERAL_NUMBER
effective function
add (other: MUTABLE_BIG_INTEGER)
effective procedure
Add other into Current.
add_to (other: MUTABLE_BIG_INTEGER, res: MUTABLE_BIG_INTEGER)
effective procedure
Add other and Current, and put the result in res.
add_integer (other: INTEGER_32)
effective procedure
Add other into Current.
add_integer_64 (other: INTEGER_64)
effective procedure
Add other into Current.
add_natural (other: MUTABLE_BIG_INTEGER)
effective procedure
Same behavior as add, but this one works only when Current and other are both positive numbers and are both greater than zero.
subtract (other: MUTABLE_BIG_INTEGER)
effective procedure
Subtract other from Current.
subtract_to (other: MUTABLE_BIG_INTEGER, res: MUTABLE_BIG_INTEGER)
effective procedure
Subtract other from Current and put it in res.
subtract_integer (other: INTEGER_32)
effective procedure
divide (other: MUTABLE_BIG_INTEGER)
effective procedure
Put the the quotient of the Euclidian division of Current by other in Current.
mod (other: MUTABLE_BIG_INTEGER)
effective procedure
Put the the remainder of the Euclidian division of Current by other in Current.
divide_with_remainder_to (other: MUTABLE_BIG_INTEGER, remainder: MUTABLE_BIG_INTEGER)
effective procedure
Euclidian division.
remainder_with_quotient_to (other: MUTABLE_BIG_INTEGER, quotient: MUTABLE_BIG_INTEGER)
effective procedure
Euclidian division.
divide_to (other: MUTABLE_BIG_INTEGER, quotient: MUTABLE_BIG_INTEGER, remainder: MUTABLE_BIG_INTEGER)
effective procedure
Euclidian division.
shift_left (n: INTEGER_32)
effective procedure
Shift bits of magnitude by n position left.
shift_right (n: INTEGER_32)
effective procedure
Right shift Current n bits.
gcd (other: MUTABLE_BIG_INTEGER)
effective procedure
Compute GCD of Current and other.
multiply (other: MUTABLE_BIG_INTEGER)
effective procedure
Multiply Current by other.
multiply_to (other: MUTABLE_BIG_INTEGER, res: MUTABLE_BIG_INTEGER)
effective procedure
Multiply the contents of Current and other and place the result in res.
multiply_integer (other: INTEGER_32, res: MUTABLE_BIG_INTEGER)
effective procedure
Multiply the contents of Current and other and place the result in res.
multiply_like_human (other: MUTABLE_BIG_INTEGER)
effective procedure
Simple multiply.
multiply_like_human_aux (other: MUTABLE_BIG_INTEGER)
effective procedure
Only used by multiply_to_like_human.
multiply_like_human_aux_reverse (other: MUTABLE_BIG_INTEGER)
effective procedure
Only used by multiply_to_like_human.
multiply_to_like_human (other: MUTABLE_BIG_INTEGER, res: MUTABLE_BIG_INTEGER)
effective procedure
Simple multiply.
is_zero: BOOLEAN
effective function
Is it 0?
is_one: BOOLEAN
effective function
Is it 1?
is_one_negative: BOOLEAN
effective function
Is it -1 ?
is_negative: BOOLEAN
effective function
Is Current negative integer?
is_positive: BOOLEAN
effective function
Is Current positive integer?
is_even: BOOLEAN
effective function
Is Current even?
is_odd: BOOLEAN
effective function
Is Current odd?
is_equal (other: MUTABLE_BIG_INTEGER): BOOLEAN
effective function
Is other attached to an object considered equal to current object?
infix "<" (other: MUTABLE_BIG_INTEGER): BOOLEAN
effective function
Is Current strictly less than other?
abs_compare (other: MUTABLE_BIG_INTEGER): INTEGER_32
effective function
Compare the magnitude of Current and other.
to_string: STRING
effective function
The decimal view of Current into a new allocated STRING.
to_unicode_string: UNICODE_STRING
effective function
The decimal view of Current into a new allocated UNICODE_STRING.
append_in (buffer: STRING)
effective procedure
Append in the buffer the equivalent of to_string.
append_in_unicode (buffer: UNICODE_STRING)
effective procedure
Append in the buffer the equivalent of to_string.
to_string_format (s: INTEGER_32): STRING
effective function
Same as to_string but the result is on s character and the number is right aligned.
to_unicode_string_format (s: INTEGER_32): UNICODE_STRING
effective function
Same as to_unicode_string but the result is on s character and the number is right aligned.
append_in_format (str: STRING, s: INTEGER_32)
effective procedure
Append the equivalent of to_string_format at the end of str.
append_in_unicode_format (str: UNICODE_STRING, s: INTEGER_32)
effective procedure
Append the equivalent of to_unicode_string_format at the end of str.
is_printable: BOOLEAN
effective function
True if decimal view of Current is short enougth to be put in a STRING.
out_in_tagged_out_memory
effective procedure
Append terse printable represention of current object in tagged_out_memory.
fill_tagged_out_memory
effective procedure
Append a viewable information in tagged_out_memory in order to affect the behavior of out, tagged_out, etc.
negate
effective procedure
Negate the sign of Current.
abs
effective procedure
Absolute value of Current.
sign: INTEGER_8
effective function
Sign of Current (0 -1 or 1).
set_with_zero
effective procedure
hash_code: INTEGER_32
effective function
The hash-code value of Current.
copy (other: MUTABLE_BIG_INTEGER)
effective procedure
Update current object using fields of object attached to other, so as to yield equal objects.
swap_with (other: MUTABLE_BIG_INTEGER)
effective procedure
Swap the value of Current with the value of other.
writable attribute
Holds the magnitude of Current in natural order (the most significant INTEGER_32 word has the highest address).
capacity: INTEGER_32
writable attribute
Of the allocated storage area.
integer_length: INTEGER_32
writable attribute
The number of significant INTEGER_32 words in the storage area.
offset: INTEGER_32
writable attribute
The offset of the less significant word into the storage area.
negative: BOOLEAN
writable attribute
True when Current is negative.
item (index: INTEGER_32): INTEGER_32
effective function
put (value: INTEGER_32, index: INTEGER_32)
effective procedure
set_negative (n: BOOLEAN)
effective procedure
set_integer_length (il: INTEGER_32)
effective procedure
set_offset (o: INTEGER_32)
effective procedure
set_ilo (il: INTEGER_32, o: INTEGER_32)
effective procedure
set_storage (new_storage: NATIVE_ARRAY[INTEGER_32])
effective procedure
set_capacity (new_capacity: INTEGER_32)
effective procedure
set_all (new_storage: NATIVE_ARRAY[INTEGER_32], new_capacity: INTEGER_32, new_integer_length: INTEGER_32, new_offset: INTEGER_32, new_negative: BOOLEAN)
effective procedure
primitive_shift_left (n: INTEGER_8)
effective procedure
Left shift Current with no need to extend the storage.
primitive_shift_right (n: INTEGER_8)
effective procedure
Right shift Current of n bits.
divide_one_word (divisor: INTEGER_32): INTEGER_32
effective function
This method is used by divide.
divide_sign_correction (other: MUTABLE_BIG_INTEGER, quotient: MUTABLE_BIG_INTEGER, remainder: MUTABLE_BIG_INTEGER)
effective procedure
Correct the value of quotient and remainder after an "unsigned" division.
divide_sign_correction_bis (other: MUTABLE_BIG_INTEGER, quotient: MUTABLE_BIG_INTEGER, current_negative: BOOLEAN)
effective procedure
Correct the value of quotient and remainder after an "unsigned" division.
multiply_and_subtract (u1: INTEGER_32, qhat: INTEGER_32, d_storage: NATIVE_ARRAY[INTEGER_32], d_offset: INTEGER_32, r_storage: NATIVE_ARRAY[INTEGER_32], r_offset: INTEGER_32, length: INTEGER_32): BOOLEAN
effective function
Only used by divide.
add_back (old_u1: INTEGER_32, d_storage: NATIVE_ARRAY[INTEGER_32], d_offset: INTEGER_32, r_storage: NATIVE_ARRAY[INTEGER_32], r_offset: INTEGER_32, length: INTEGER_32): BOOLEAN
effective function
Only used by divide.
is_a_good_divide (other: MUTABLE_BIG_INTEGER, quotient: MUTABLE_BIG_INTEGER, remainder: MUTABLE_BIG_INTEGER): BOOLEAN
effective function
normalize: INTEGER_8
effective function
Shift left until the most significant bit is on.
register1: MUTABLE_BIG_INTEGER
once function
register2: MUTABLE_BIG_INTEGER
once function
Real_base: REAL_64
once function
add_magnitude (other: MUTABLE_BIG_INTEGER)
effective procedure
Add the magnitude of Current and other regardless of signs.
subtract_magnitude (other: MUTABLE_BIG_INTEGER)
effective procedure
Subtract other from Current (The result is placed in Current) and change negative (the sign) if necessary.
subtract_magnitude_raw (other: MUTABLE_BIG_INTEGER)
effective procedure
Subtract (raw) the storage of other from Current.
subtract_magnitude_raw_reverse (other: MUTABLE_BIG_INTEGER)
effective procedure
Subtract (raw) the storage of Current from other and put it in Current.
subtract_magnitude_raw_truncated (other: MUTABLE_BIG_INTEGER)
effective procedure
Subtract (raw) the storage of other from Current where other is truncated to the size of Current.
subtract_magnitude_raw_reverse_truncated (other: MUTABLE_BIG_INTEGER)
effective procedure
Subtract (raw) the storage of Current from other and put it in Current, where other is truncated to the size of Current.
char_buffer: FAST_ARRAY[CHARACTER]
once function
append_in_char_buffer: INTEGER_32
effective function
Tool for append_in and append_in_unicode.
capacity_from_lower_bound (actual_capacity: INTEGER_32, needed_capacity: INTEGER_32): INTEGER_32
effective function
Give the smallest power of 2 greater than needed_capacity and actual_capacity.
capacity_from_upper_bound (actual_capacity: INTEGER_32, needed_capacity: INTEGER_32): INTEGER_32
effective function
Give the smallest power of 2 greater than needed_capacity.
unsigned_less_than (a: INTEGER_32, b: INTEGER_32): BOOLEAN
Unsigned "<".
unsigned_greater_than (a: INTEGER_32, b: INTEGER_32): BOOLEAN
Unsigned ">".
unsigned_greater_or_equal (a: INTEGER_32, b: INTEGER_32): BOOLEAN
Unsigned ">=".
unsigned_32_to_integer_64 (integer_32: INTEGER_32): INTEGER_64
Return the unsigned value of the integer_32.
Give the address of the corresponding word of s.
mbi_inc (integer_32_adr: POINTER): BOOLEAN
Increment the value at integer_32_adr.
mbi_add (a: INTEGER_32, b: INTEGER_32, integer_32_adr: POINTER): BOOLEAN
t.item(n) := a + b Overflow if "Result = True".
mbi_add_with_inc (a: INTEGER_32, b: INTEGER_32, integer_32_adr: POINTER): BOOLEAN
t.item(n) := a + b + 1 Overflow if "Result = True".
mbi_dec (integer_32_adr: POINTER): BOOLEAN
Put a - 1 in the item n in the NATIVE_ARRAY t.
mbi_subtract (a: INTEGER_32, b: INTEGER_32, integer_32_adr: POINTER): BOOLEAN
t.item(n) := a - b Underflow if "Result = True".
mbi_subtract_with_dec (a: INTEGER_32, b: INTEGER_32, integer_32_adr: POINTER): BOOLEAN
t.item(n) := a - b - 1 Underflow if "Result = True".
mbi_multiply (a: INTEGER_32, b: INTEGER_32, integer_32_adr: POINTER): INTEGER_32
put a * b in t@n and return the overflow.
mbi_multiply_with_add (a: INTEGER_32, b: INTEGER_32, c: INTEGER_32, integer_32_adr: POINTER): INTEGER_32
put a * b + c in t@n and return the overflow.
mbi_multiply_with_2_add (a: INTEGER_32, b: INTEGER_32, c: INTEGER_32, d: INTEGER_32, integer_32_adr: POINTER): INTEGER_32
put a * b + c + d in t@n and return the overflow.
mbi_divide (u1: INTEGER_32, u0: INTEGER_32, d: INTEGER_32, r_int32adr: POINTER): INTEGER_32
Divide u1u0 by d, put the remainder in r and return the quotient.
string_buffer: STRING
once function
unicode_string_buffer: UNICODE_STRING
once function
infix "<=" (other: MUTABLE_BIG_INTEGER): BOOLEAN
effective function
Is Current less than or equal other?
infix ">" (other: MUTABLE_BIG_INTEGER): BOOLEAN
effective function
Is Current strictly greater than other?
infix ">=" (other: MUTABLE_BIG_INTEGER): BOOLEAN
effective function
Is Current greater than or equal than other?
in_range (lower: MUTABLE_BIG_INTEGER, upper: MUTABLE_BIG_INTEGER): BOOLEAN
effective function
Return True if Current is in range [lower..upper]
See also min, max, compare.
compare (other: MUTABLE_BIG_INTEGER): INTEGER_32
effective function
If current object equal to other, 0 if smaller, -1; if greater, 1.
three_way_comparison (other: MUTABLE_BIG_INTEGER): INTEGER_32
effective function
If current object equal to other, 0 if smaller, -1; if greater, 1.
min (other: MUTABLE_BIG_INTEGER): MUTABLE_BIG_INTEGER
effective function
Minimum of Current and other.
max (other: MUTABLE_BIG_INTEGER): MUTABLE_BIG_INTEGER
effective function
Maximum of Current and other.
Maximum_character_code: INTEGER_16
Largest supported code for CHARACTER values.
Maximum_integer_8: INTEGER_8
constant attribute
Largest supported value of type INTEGER_8.
Maximum_integer_16: INTEGER_16
constant attribute
Largest supported value of type INTEGER_16.
Maximum_integer: INTEGER_32
constant attribute
Largest supported value of type INTEGER/INTEGER_32.
Maximum_integer_32: INTEGER_32
constant attribute
Largest supported value of type INTEGER/INTEGER_32.
Maximum_integer_64: INTEGER_64
constant attribute
Largest supported value of type INTEGER_64.
Maximum_real_32: REAL_32
constant attribute
Largest non-special (no NaNs nor infinity) supported value of type REAL_32.
Maximum_real: REAL_64
Largest non-special (no NaNs nor infinity) supported value of type REAL.
Maximum_real_64: REAL_64
Largest non-special (no NaNs nor infinity) supported value of type REAL.
Maximum_real_80: REAL_EXTENDED
Largest supported value of type REAL_80.
Minimum_character_code: INTEGER_16
Smallest supported code for CHARACTER values.
Minimum_integer_8: INTEGER_8
constant attribute
Smallest supported value of type INTEGER_8.
Minimum_integer_16: INTEGER_16
constant attribute
Smallest supported value of type INTEGER_16.
Minimum_integer: INTEGER_32
constant attribute
Smallest supported value of type INTEGER/INTEGER_32.
Minimum_integer_32: INTEGER_32
constant attribute
Smallest supported value of type INTEGER/INTEGER_32.
Minimum_integer_64: INTEGER_64
constant attribute
Smallest supported value of type INTEGER_64.
Minimum_real_32: REAL_32
constant attribute
Smallest non-special (no NaNs nor infinity) supported value of type REAL_32.
Minimum_real: REAL_64
Smallest non-special (no NaNs nor infinity) supported value of type REAL.
Minimum_real_64: REAL_64
Smallest non-special (no NaNs nor infinity) supported value of type REAL.
Minimum_real_80: REAL_64
Smallest supported value of type REAL_80.
Boolean_bits: INTEGER_32
Number of bits in a value of type BOOLEAN.
Character_bits: INTEGER_32
Number of bits in a value of type CHARACTER.
Integer_bits: INTEGER_32
Number of bits in a value of type INTEGER.
Real_bits: INTEGER_32
constant attribute
Number of bits in a value of type REAL.
Pointer_bits: INTEGER_32
Number of bits in a value of type POINTER.