+
Point of view
All features
deferred class NUMBER
Summary
This abstract definition of a NUMBER is intended to be the unique view of the client (do not use sub-classes names at all in the client code). In order to create NUMBERs without using concrete class name, the client code can inherit NUMBER_TOOLS. (See directory tutorial/number for examples.)
Direct parents
Inherit list: COMPARABLE, HASHABLE, NUMERIC
Insert list: PLATFORM
Known children
Inherit list: FRACTION_GENERAL_NUMBER, INTEGER_GENERAL_NUMBER
Class invariant
Overview
Features
Binary operators for two NUMBERs:
{ANY}
  • infix "+" (other: NUMBER): NUMBER
    Sum of Current and other.
  • infix "-" (other: NUMBER): NUMBER
    Difference of Current and other.
  • infix "*" (other: NUMBER): NUMBER
    Product of Current and other.
  • infix "/" (other: NUMBER): NUMBER
    Quotient of Current and other.
  • infix "//" (other: NUMBER): NUMBER
    Divide Current by other (Integer division).
  • infix "\\" (other: NUMBER): NUMBER
    Remainder of division of Current by other.
  • infix "^" (exp: NUMBER): NUMBER
    Current raised to exp-th power.
  • infix "<" (other: NUMBER): BOOLEAN
    Is Current strictly less than other?
  • infix "<=" (other: NUMBER): BOOLEAN
    Is Current less or equal than other?
  • infix ">" (other: NUMBER): BOOLEAN
    Is Current strictly greater than other?
  • infix ">=" (other: NUMBER): BOOLEAN
    Is Current greater or equal than other?
  • gcd (other: NUMBER): INTEGER_GENERAL_NUMBER
    Great Common Divisor of Current and other.
Unary operators for two NUMBERs:
{ANY}
To know more about a NUMBER:
{ANY}
Conversions and printing:
{ANY}
To mimic NUMERIC:
{ANY}
To mix NUMBER and INTEGER_64:
{ANY}
To mix NUMBER and REAL_64:
{ANY}
Misc:
{ANY}
Implementation:
{NUMBER}
{NUMBER, NUMBER_TOOLS}
To implement efficient calculus
{NUMBER}
{}
To create fractions
{}
{ANY}
  • bounded_by (a_min: NUMBER, a_max: NUMBER): NUMBER
    A value that is equal to Current if it is between the limits set by a_min and a_max.
Maximum:
{}
Minimum:
{}
Bits:
{}
infix "+" (other: NUMBER): NUMBER
deferred function
{ANY}
Sum of Current and other.
infix "-" (other: NUMBER): NUMBER
effective function
{ANY}
Difference of Current and other.
infix "*" (other: NUMBER): NUMBER
deferred function
{ANY}
Product of Current and other.
infix "/" (other: NUMBER): NUMBER
effective function
{ANY}
Quotient of Current and other.
infix "//" (other: NUMBER): NUMBER
deferred function
{ANY}
Divide Current by other (Integer division).
infix "\\" (other: NUMBER): NUMBER
deferred function
{ANY}
Remainder of division of Current by other.
infix "^" (exp: NUMBER): NUMBER
effective function
{ANY}
Current raised to exp-th power.
infix "<" (other: NUMBER): BOOLEAN
deferred function
{ANY}
Is Current strictly less than other?
infix "<=" (other: NUMBER): BOOLEAN
effective function
{ANY}
Is Current less or equal than other?
infix ">" (other: NUMBER): BOOLEAN
effective function
{ANY}
Is Current strictly greater than other?
infix ">=" (other: NUMBER): BOOLEAN
effective function
{ANY}
Is Current greater or equal than other?
gcd (other: NUMBER): INTEGER_GENERAL_NUMBER
deferred function
{ANY}
Great Common Divisor of Current and other.
prefix "+": NUMBER
frozen
effective function
{ANY}
Unary plus of Current.
prefix "-": NUMBER
deferred function
{ANY}
Opposite of Current.
is_integer_8: BOOLEAN
frozen
effective function
{ANY}
Does Current value fit on an INTEGER_8?
is_integer_16: BOOLEAN
frozen
effective function
{ANY}
Does Current value fit on an INTEGER_16?
is_integer_32: BOOLEAN
frozen
effective function
{ANY}
Does Current value fit on an INTEGER?
is_integer_64: BOOLEAN
frozen
effective function
{ANY}
Does Current value fit on an INTEGER_64?
is_natural_64: BOOLEAN
frozen
effective function
{ANY}
Does Current value fit on a NATURAL_64?
in_range (lower: NUMBER, upper: NUMBER): BOOLEAN
effective function
{ANY}
Return True if Current is in range [lower..upper]
compare (other: NUMBER): INTEGER_32
effective function
{ANY}
Compare Current with other.
three_way_comparison (other: NUMBER): INTEGER_32
effective function
{ANY}
Compare Current with other.
min (other: NUMBER): NUMBER
effective function
{ANY}
Minimum of Current and other.
max (other: NUMBER): NUMBER
effective function
{ANY}
Maximum of Current and other.
is_zero: BOOLEAN
deferred function
{ANY}
Is it 0 ?
is_one: BOOLEAN
deferred function
{ANY}
Is it 1 ?
is_positive: BOOLEAN
deferred function
{ANY}
Is Current > 0 ?
is_negative: BOOLEAN
deferred function
{ANY}
Is Current < 0 ?
is_odd: BOOLEAN
effective function
{ANY}
Is odd ?
is_even: BOOLEAN
effective function
{ANY}
Is even ?
is_equal (other: NUMBER): BOOLEAN
deferred function
{ANY}
Is other attached to an object considered equal to current object?
is_integer_general_number: BOOLEAN
frozen
effective function
{ANY}
is_fraction_general_number: BOOLEAN
frozen
effective function
{ANY}
fit_real: BOOLEAN
frozen
effective function
{ANY}
to_integer_8: INTEGER_8
frozen
effective function
{ANY}
Conversion of Current in an INTEGER_8.
to_integer_16: INTEGER_16
frozen
effective function
{ANY}
Conversion of Current in an INTEGER_16.
to_integer_32: INTEGER_32
frozen
effective function
{ANY}
Conversion of Current in an INTEGER_32.
to_integer_64: INTEGER_64
frozen
effective function
{ANY}
Conversion of Current in an INTEGER.
to_natural_64: NATURAL_64
frozen
effective function
{ANY}
Conversion of Current in a NATURAL_64.
force_to_real_64: REAL_64
deferred function
{ANY}
Conversion of Current in a REAL_64.
to_string: STRING
frozen
effective function
{ANY}
Convert the NUMBER into a new allocated STRING.
to_unicode_string: UNICODE_STRING
frozen
effective function
{ANY}
Convert the NUMBER into a new allocated UNICODE_STRING.
append_in (buffer: STRING)
deferred procedure
{ANY}
Append the equivalent of to_string at the end of buffer.
append_in_unicode (buffer: UNICODE_STRING)
deferred procedure
{ANY}
Append the equivalent of to_unicode_string at the end of buffer.
to_string_format (s: INTEGER_32): STRING
frozen
effective function
{ANY}
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
frozen
effective function
{ANY}
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)
frozen
effective procedure
{ANY}
Append the equivalent of to_string_format at the end of str.
append_in_unicode_format (str: UNICODE_STRING, s: INTEGER_32)
frozen
effective procedure
{ANY}
Append the equivalent of to_unicode_string_format at the end of str.
to_decimal (digits: INTEGER_32, all_digits: BOOLEAN): STRING
frozen
effective function
{ANY}
Convert Current into its decimal view.
append_decimal_in (buffer: STRING, digits: INTEGER_32, all_digits: BOOLEAN)
deferred procedure
{ANY}
Append the equivalent of to_decimal at the end of buffer.
decimal_digit: CHARACTER
frozen
effective function
{ANY}
Gives the corresponding CHARACTER for range 0..9.
digit: CHARACTER
effective function
{ANY}
Gives the corresponding CHARACTER for range 0..9.
divisible (other: NUMBER): BOOLEAN
effective function
{ANY}
Is other a valid divisor for Current ?
one: NUMBER
once function
{ANY}
The neutral element of multiplication.
zero: NUMBER
once function
{ANY}
The neutral element of addition.
sign: INTEGER_8
frozen
effective function
{ANY}
Sign of Current (0 or -1 or 1).
sqrt: REAL_64
effective function
{ANY}
Compute the square routine.
log: REAL_64
frozen
effective function
{ANY}
abs: NUMBER
effective function
{ANY}
infix "@+" (other: INTEGER_64): NUMBER
deferred function
{ANY}
Sum of Current and other.
infix "@-" (other: INTEGER_64): NUMBER
effective function
{ANY}
Difference of Current and other.
infix "@*" (other: INTEGER_64): NUMBER
deferred function
{ANY}
infix "@/" (other: INTEGER_64): NUMBER
deferred function
{ANY}
Quotient of Current and other.
infix "@//" (other: INTEGER_64): NUMBER
deferred function
{ANY}
Divide Current by other (Integer division).
infix "@\\" (other: INTEGER_64): NUMBER
deferred function
{ANY}
Remainder of division of Current by other.
infix "@^" (exp: INTEGER_64): NUMBER
effective function
{ANY}
infix "@=" (other: INTEGER_64): BOOLEAN
deferred function
{ANY}
Is Current equal other ?
infix "@<" (other: INTEGER_64): BOOLEAN
deferred function
{ANY}
Is Current strictly less than other?
infix "@<=" (other: INTEGER_64): BOOLEAN
deferred function
{ANY}
Is Current less or equal other?
infix "@>" (other: INTEGER_64): BOOLEAN
deferred function
{ANY}
Is Current strictly greater than other?
infix "@>=" (other: INTEGER_64): BOOLEAN
deferred function
{ANY}
Is Current greater or equal than other?
infix "#=" (other: REAL_64): BOOLEAN
deferred function
{ANY}
Is Current equal other?
infix "#<" (other: REAL_64): BOOLEAN
deferred function
{ANY}
Is Current strictly less than other?
infix "#<=" (other: REAL_64): BOOLEAN
deferred function
{ANY}
Is Current less or equal other?
infix "#>" (other: REAL_64): BOOLEAN
deferred function
{ANY}
Is Current strictly greater than other?
infix "#>=" (other: REAL_64): BOOLEAN
deferred function
{ANY}
Is Current greater or equal than other?
out_in_tagged_out_memory
effective procedure
{ANY}
Append terse printable representation of current object in tagged_out_memory.
fill_tagged_out_memory
effective procedure
{ANY}
Append a viewable information in tagged_out_memory in order to affect the behavior of out, tagged_out, etc.
hash_code: INTEGER_32
deferred function
{ANY}
The hash-code value of Current.
inverse: NUMBER
deferred function
{ANY}
factorial: NUMBER
deferred function
{ANY}
deferred function
{ANY}
deferred function
{ANY}
add_with_integer_64_number (other: INTEGER_64_NUMBER): NUMBER
frozen
effective function
add_with_big_integer_number (other: BIG_INTEGER_NUMBER): NUMBER
deferred function
add_with_fraction_with_big_integer_number (other: FRACTION_WITH_BIG_INTEGER_NUMBER): NUMBER
deferred function
multiply_with_integer_64_number (other: INTEGER_64_NUMBER): NUMBER
effective function
multiply_with_big_integer_number (other: BIG_INTEGER_NUMBER): NUMBER
deferred function
multiply_with_fraction_with_big_integer_number (other: FRACTION_WITH_BIG_INTEGER_NUMBER): NUMBER
deferred function
greater_with_integer_64_number (other: INTEGER_64_NUMBER): BOOLEAN
effective function
greater_with_big_integer_number (other: BIG_INTEGER_NUMBER): BOOLEAN
deferred function
greater_with_fraction_with_big_integer_number (other: FRACTION_WITH_BIG_INTEGER_NUMBER): BOOLEAN
deferred function
gcd_with_integer_64_number (other: INTEGER_64_NUMBER): INTEGER_GENERAL_NUMBER
deferred function
gcd_with_big_integer_number (other: BIG_INTEGER_NUMBER): INTEGER_GENERAL_NUMBER
deferred function
max_double: NUMBER
once function
min_double: NUMBER
once function
mutable_register1: MUTABLE_BIG_INTEGER
once function
mutable_register2: MUTABLE_BIG_INTEGER
once function
mutable_register3: MUTABLE_BIG_INTEGER
once function
mutable_register4: MUTABLE_BIG_INTEGER
once function
string_buffer: STRING
once function
{}
unicode_string_buffer: UNICODE_STRING
once function
{}
from_two_integer (n: INTEGER_64, d: INTEGER_64): NUMBER
effective function
{}
from_two_integer_general_number (n: INTEGER_GENERAL_NUMBER, d: INTEGER_GENERAL_NUMBER): NUMBER
effective function
{}
from_integer_and_integer_general_number (n: INTEGER_64, d: INTEGER_GENERAL_NUMBER): NUMBER
effective function
{}
from_integer_general_number_and_integer (n: INTEGER_GENERAL_NUMBER, d: INTEGER_64): NUMBER
effective function
{}
bounded_by (a_min: NUMBER, a_max: NUMBER): NUMBER
effective function
{ANY}
A value that is equal to Current if it is between the limits set by a_min and a_max.
Maximum_character_code: INTEGER_16
{}
Largest supported code for CHARACTER values.
Maximum_integer_8: INTEGER_8
is 127
constant attribute
{}
Largest supported value of type INTEGER_8.
Maximum_integer_16: INTEGER_16
is 32767
constant attribute
{}
Largest supported value of type INTEGER_16.
Maximum_integer: INTEGER_32
is 2147483647
constant attribute
{}
Largest supported value of type INTEGER/INTEGER_32.
Maximum_integer_32: INTEGER_32
is 2147483647
constant attribute
{}
Largest supported value of type INTEGER/INTEGER_32.
Maximum_integer_64: INTEGER_64
is 9223372036854775807
constant attribute
{}
Largest supported value of type INTEGER_64.
Maximum_real_32: REAL_32
is {REAL_32 3.4028234663852885981170418348451692544e+38}
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
is -128
constant attribute
{}
Smallest supported value of type INTEGER_8.
Minimum_integer_16: INTEGER_16
is -32768
constant attribute
{}
Smallest supported value of type INTEGER_16.
Minimum_integer: INTEGER_32
is -2147483648
constant attribute
{}
Smallest supported value of type INTEGER/INTEGER_32.
Minimum_integer_32: INTEGER_32
is -2147483648
constant attribute
{}
Smallest supported value of type INTEGER/INTEGER_32.
Minimum_integer_64: INTEGER_64
is -9223372036854775808
constant attribute
{}
Smallest supported value of type INTEGER_64.
Minimum_real_32: REAL_32
is {REAL_32 -3.40282346638528859811704183484516925440e+38}
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
is 64
constant attribute
{}
Number of bits in a value of type REAL.
Pointer_bits: INTEGER_32
{}
Number of bits in a value of type POINTER.