+
Point of view
All features
expanded class REAL_64
Summary
Direct parents
Insert list: REAL_GENERAL
Overview
Features
Conversions:
{ANY}
{ANY}
• zero: REAL_64
Neutral element for "+" and "-".
• one: REAL_64
Neutral element for "*" and "/".
• infix "~=" (other: REAL_64): BOOLEAN
Is Current near equal to other.
• hash_code: INTEGER_32
The hash-code value of Current.
• mantissa_bits: INTEGER_8
Give the number of bits, corresponding to the mantissa, in the binary representation of the real number.
• exponent_bits: INTEGER_8
Give the number of bits, corresponding to the exponent, in the binary representation of the real number.
{}
{ANY}
Conversions:
{ANY}
• rounded: REAL_64
Round to nearest integer away from zero.
• floor: REAL_64
Largest integral value no greater than Current.
• ceiling: REAL_64
Smallest integral value no smaller than Current.
Object Printing:
{ANY}
Maths functions:
{ANY}
• sqrt: REAL_64
Square root of Current.
• sin: REAL_64
Sine of Current.
• cos: REAL_64
Cosine of Current.
• tan: REAL_64
Tangent of Current.
• asin: REAL_64
Arc Sine of Current.
• acos: REAL_64
Arc Cosine of Current.
• atan: REAL_64
Arc Tangent of Current.
• atan2 (x: REAL_64): REAL_64
Arc Tangent of Current / x.
• sinh: REAL_64
Hyperbolic Sine of Current.
• cosh: REAL_64
Hyperbolic Cosine of Current.
• tanh: REAL_64
Hyperbolic Tangent of Current.
• exp: REAL_64
Exponential of Current.
• log: REAL_64
Natural Logarithm of Current.
• log10: REAL_64
Base-10 Logarithm of Current.
• pow (e: REAL_64): REAL_64
Current raised to the power of e (ANSI C pow).
Miscellaneous:
{ANY}
{}
{ANY}
• in_range (lower: REAL_64, upper: REAL_64): BOOLEAN
Return True if Current is in range [lower..upper]
• compare (other: REAL_64): INTEGER_32
If current object equal to other, 0 if smaller, -1; if greater, 1.
• three_way_comparison (other: REAL_64): INTEGER_32
If current object equal to other, 0 if smaller, -1; if greater, 1.
• min (other: REAL_64): REAL_64
Minimum of Current and other.
• max (other: REAL_64): REAL_64
Maximum of Current and other.
• bounded_by (a_min: REAL_64, a_max: REAL_64): REAL_64
A value that is equal to Current if it is between the limits set by a_min and a_max.
{ANY}
• set_precision (a_precision: INTEGER_8)
Set the mantissa precision, used by the ~= operator The nearer to 0, the more precise.
{}
force_to_real_32: REAL_32
{ANY}
force_to_integer_64: INTEGER_64
{ANY}
force_to_integer_32: INTEGER_32
{ANY}
force_to_integer_16: INTEGER_16
{ANY}
force_to_natural_64: NATURAL_64
{ANY}
force_to_natural_32: NATURAL_32
{ANY}
force_to_natural_16: NATURAL_16
{ANY}
zero: REAL_64
is 0.0
constant attribute
{ANY}
Neutral element for "+" and "-".
one: REAL_64
is 1.0
constant attribute
{ANY}
Neutral element for "*" and "/".
infix "~=" (other: REAL_64): BOOLEAN
effective function
{ANY}
Is Current near equal to other.
hash_code: INTEGER_32
effective function
{ANY}
The hash-code value of Current.
ensure
• good_hash_value: Result >= 0
mantissa_bits: INTEGER_8
is 52
constant attribute
{ANY}
Give the number of bits, corresponding to the mantissa, in the binary representation of the real number.
exponent_bits: INTEGER_8
is 11
constant attribute
{ANY}
Give the number of bits, corresponding to the exponent, in the binary representation of the real number.
sprintf (buffer: NATIVE_ARRAY[CHARACTER], mode: CHARACTER, f: INTEGER_32, value: REAL_64)
{}
Put in the buffer a viewable version of the value using mode with f digits for the fractional part.
Assume the buffer is large enough.
require
• mode = 'f' xor mode = 'e'
• f >= 0
is_equal (other: REAL_64): BOOLEAN
effective function
{ANY}
Is other attached to an object considered equal to current object?
require
• other /= Void
• other /= Void
• other /= Void
ensure
• commutative: generating_type = other.generating_type implies Result = other.is_equal(Current)
• trichotomy: Result = not Current < other and not other < Current
• Result implies hash_code = other.hash_code
prefix "+": REAL_64
effective function
{ANY}
Unary plus of Current.
prefix "-": REAL_64
{ANY}
Unary minus of Current.
infix "+" (other: REAL_64): REAL_64
{ANY}
Sum with other (commutative).
infix "-" (other: REAL_64): REAL_64
{ANY}
Result of subtracting other.
infix "*" (other: REAL_64): REAL_64
{ANY}
Product by other.
infix "/" (other: REAL_64): REAL_64
{ANY}
Division by other.
require
• other /= Void
• other /= zero
• divisible(other)
infix "^" (e: INTEGER_32): REAL_64
{ANY}
infix "<" (other: REAL_64): BOOLEAN
{ANY}
Is Current strictly less than other?
require
• other_exists: other /= Void
ensure
• asymmetric: Result implies not other < Current
infix "<=" (other: REAL_64): BOOLEAN
{ANY}
Is Current less than or equal other?
require
• other_exists: other /= Void
ensure
• definition: Result = Current < other or is_equal(other)
infix ">" (other: REAL_64): BOOLEAN
{ANY}
Is Current strictly greater than other?
require
• other_exists: other /= Void
ensure
• definition: Result = other < Current
infix ">=" (other: REAL_64): BOOLEAN
{ANY}
Is Current greater than or equal than other?
require
• other_exists: other /= Void
ensure
• definition: Result = other <= Current
abs: REAL_64
effective function
{ANY}
is_not_a_number: BOOLEAN
{ANY}
Also known as NaN in IEEE-754.
is_infinity: BOOLEAN
{ANY}
Is either plus or minus infinity?
is_zero: BOOLEAN
effective function
{ANY}
Is either -0.0 or +0.0 ?
ensure
• definition: Result = Current = zero or else Current = - zero
precision: INTEGER_8
effective function
{ANY}
ensure
is_subnormal: BOOLEAN
{ANY}
Is it too small to be represented in normalized format.
ensure
• Result = Current = zero or else Current = - zero
is_normal: BOOLEAN
{ANY}
The most general situation (see ensure).
ensure
• Result = not is_subnormal or is_infinity or is_not_a_number
divisible (other: REAL_64): BOOLEAN
effective function
{ANY}
May Current be divided by other ?
require
• other /= Void
rounded: REAL_64
frozen
{ANY}
Round to nearest integer away from zero.
floor: REAL_64
frozen
{ANY}
Largest integral value no greater than Current.
ceiling: REAL_64
frozen
{ANY}
Smallest integral value no smaller than Current.
to_string: STRING
effective function
{ANY}
Convert Current into a new allocated STRING using 6 as the default number of digits for the fractional part.
Example: (1.5).to_string will return "1.500000".
Note: see also to_string_format, to_string_scientific as well as append_in to save memory.
to_string_format (f: INTEGER_32): STRING
effective function
{ANY}
Convert Current into a new allocated STRING using f digits for fractional part.
Example: (1.5).to_string_format(2) will return "1.50".
Note: see also to_string_scientific, to_string as well as append_in_format to save memory.
require
• f >= 0
to_string_scientific (f: INTEGER_32): STRING
effective function
{ANY}
Convert Current into a new allocated STRING, using the scientific notation with f digits for the fractional part.
Example: (155.5).to_string_scientific(4) will return "1.5550e+02".
Note: see also to_string, to_string_format as well as append_in_scientific to save memory.
append_in (buffer: STRING)
effective procedure
{ANY}
Append the equivalent of to_string at the end of buffer.
Thus you can save memory because no other STRING is allocated for the job.
require
• buffer /= Void
append_in_format (str: STRING, f: INTEGER_32)
effective procedure
{ANY}
Append the equivalent of to_string_format at the end of buffer.
Thus you can save memory because no other STRING is allocated for the job.
require
• str /= Void
• f >= 0
append_in_scientific (str: STRING, f: INTEGER_32)
effective procedure
{ANY}
Append the equivalent of to_string_scientific at the end of buffer.
Thus you can save memory because no other STRING is allocated for the job.
require
• str /= Void
• f >= 0
out_in_tagged_out_memory
effective procedure
{ANY}
Append terse printable representation of current object in tagged_out_memory.
require
• locked: tagged_out_locked
• locked: tagged_out_locked
• locked: tagged_out_locked
ensure
• still_locked: tagged_out_locked
• not_cleared: tagged_out_memory.count >= old tagged_out_memory.count
• append_only: old tagged_out_memory.twin.is_equal(tagged_out_memory.substring(1, old tagged_out_memory.count))
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.
require
• locked: tagged_out_locked
• locked: tagged_out_locked
• locked: tagged_out_locked
ensure
• still_locked: tagged_out_locked
sqrt: REAL_64
frozen
{ANY}
Square root of Current.
require
• Current >= zero
sin: REAL_64
frozen
{ANY}
Sine of Current.
cos: REAL_64
frozen
{ANY}
Cosine of Current.
tan: REAL_64
frozen
{ANY}
Tangent of Current.
asin: REAL_64
frozen
{ANY}
Arc Sine of Current.
acos: REAL_64
frozen
{ANY}
Arc Cosine of Current.
atan: REAL_64
frozen
{ANY}
Arc Tangent of Current.
atan2 (x: REAL_64): REAL_64
frozen
{ANY}
Arc Tangent of Current / x.
sinh: REAL_64
frozen
{ANY}
Hyperbolic Sine of Current.
cosh: REAL_64
frozen
{ANY}
Hyperbolic Cosine of Current.
tanh: REAL_64
frozen
{ANY}
Hyperbolic Tangent of Current.
exp: REAL_64
frozen
{ANY}
Exponential of Current.
log: REAL_64
frozen
{ANY}
Natural Logarithm of Current.
log10: REAL_64
frozen
{ANY}
Base-10 Logarithm of Current.
pow (e: REAL_64): REAL_64
frozen
{ANY}
Current raised to the power of e (ANSI C pow).
sign: INTEGER_8
effective function
{ANY}
Sign of Current (0 -1 or 1).
ensure
• Result.in_range(-1, 1)
sprintf_buffer: NATIVE_ARRAY[CHARACTER]
once function
{}
in_range (lower: REAL_64, upper: REAL_64): BOOLEAN
effective function
{ANY}
Return True if Current is in range [lower..upper]
ensure
• Result = Current >= lower and Current <= upper
compare (other: REAL_64): INTEGER_32
effective function
{ANY}
If current object equal to other, 0 if smaller, -1; if greater, 1.
require
• other_exists: other /= Void
ensure
• equal_zero: Result = 0 = is_equal(other)
• smaller_negative: Result = -1 = Current < other
• greater_positive: Result = 1 = Current > other
three_way_comparison (other: REAL_64): INTEGER_32
effective function
{ANY}
If current object equal to other, 0 if smaller, -1; if greater, 1.
require
• other_exists: other /= Void
ensure
• equal_zero: Result = 0 = is_equal(other)
• smaller_negative: Result = -1 = Current < other
• greater_positive: Result = 1 = Current > other
min (other: REAL_64): REAL_64
effective function
{ANY}
Minimum of Current and other.
require
• other /= Void
ensure
• Result <= Current and then Result <= other
• compare(Result) = 0 or else other.compare(Result) = 0
max (other: REAL_64): REAL_64
effective function
{ANY}
Maximum of Current and other.
require
• other /= Void
ensure
• Result >= Current and then Result >= other
• compare(Result) = 0 or else other.compare(Result) = 0
bounded_by (a_min: REAL_64, a_max: REAL_64): REAL_64
effective function
{ANY}
A value that is equal to Current if it is between the limits set by a_min and a_max.
Otherwise it's a_min if Current is smaller or a_max if Current is greater It's a shortcut for Current.min(a_max).max(a_min) also known as "clamp" in the widespread C library Glib
ensure
• correctness: Result.in_range(a_min, a_max)
set_precision (a_precision: INTEGER_8)
effective procedure
{ANY}
Set the mantissa precision, used by the ~= operator The nearer to 0, the more precise.
require
• a_precision >= 0
ensure
precision_ref: REFERENCE[INTEGER_8]
once function
{}