Top
POINTER
REVERSE_COLLECTION_SORTER
expanded class interface REAL
--
-- REAL is the type for real numbers. You may consider DOUBLE type if you
-- need more precision.
--
-- Note: An Eiffel REAL is mapped as a C float or as a Java float.
--
feature(s) from HASHABLE hash_code: INTEGER
-- The hash-code value of Current.
ensure
good_hash_value: Result >= 0
feature(s) from NUMERIC infix "+" (other: like Current): REAL
-- Sum with other (commutative).
-- require
-- other /= Void
infix "-" (other: like Current): REAL
-- Result of substracting other.
-- require
-- other /= Void
infix "*" (other: like Current): REAL
-- Product by other.
-- require
-- other /= Void
infix "/" (other: like Current): REAL
-- Division by other.
require
other /= Void;
divisible(other)
prefix "+": like Current
-- Unary plus of Current.
prefix "-": REAL
-- Unary minus of Current.
divisible (other: like Current): BOOLEAN
-- May Current be divided by other ?
require
other /= Void
one: REAL
-- Neutral element for "*" and "/".
zero: REAL
-- Neutral element for "+" and "-".
sign: INTEGER_8
-- Sign of Current (0 -1 or 1).
ensure
-1 <= Result;
Result <= 1
feature(s) from COMPARABLE is_equal (other: like Current): BOOLEAN
-- Is other attached to an object considered equal to
-- current object ?
require
other /= Void
ensure
trichotomy: Result = (not (Current < other) and not (other < Current));
generating_type = other.generating_type implies Result = other.is_equal(Current)
infix "<" (other: like Current): BOOLEAN
-- Is Current strictly less than other?
require
other_exists: other /= Void
ensure
asymmetric: Result implies not (other < Current)
infix "<=" (other: like Current): BOOLEAN
require
other_exists: other /= Void
ensure
definition: Result = (Current < other or is_equal(other))
infix ">" (other: like Current): BOOLEAN
require
other_exists: other /= Void
ensure
definition: Result = (other < Current)
infix ">=" (other: like Current): BOOLEAN
require
other_exists: other /= Void
ensure
definition: Result = (other <= Current)
in_range (lower, upper: like Current): BOOLEAN
-- Return true if Current is in range [lower..upper]
ensure
Result = (Current >= lower and Current <= upper)
compare (other: like Current): INTEGER
-- 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: like Current): INTEGER
-- 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: like Current): like Current
-- 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: like Current): like Current
-- Maximum of Current and other.
require
other /= Void
ensure
Result >= Current and then Result >= other;
compare(Result) = 0 or else other.compare(Result) = 0
feature(s) from REAL infix "^" (e: INTEGER): DOUBLE
-- Raise Current to e-th power (see also pow).
abs: like Current
floor: INTEGER
-- Greatest integral value no greater than Current.
ensure
result_no_greater: Result <= Current;
close_enough: Current - Result < one
ceiling: INTEGER
-- Smallest integral value no smaller than Current.
ensure
result_no_smaller: Result >= Current;
close_enough: Result - Current < one
rounded: INTEGER
-- Rounded integral value.
truncated_to_integer: INTEGER
-- Integer part (same sign, largest absolute value
-- no greater than Current).
ensure
Result.to_real <= Current
to_string: STRING
-- Convert the REAL into a new allocated STRING.
-- Note: see append_in to save memory.
append_in (str: STRING)
-- Append the equivalent of to_string at the end of
-- str. Thus you can save memory because no other
-- STRING is allocate for the job.
require
str /= Void
to_string_format (d: INTEGER): STRING
-- Convert the REAL into a new allocated STRING including
-- only d digits in fractionnal part.
-- Note: see append_in_format to save memory.
append_in_format (str: STRING; f: INTEGER)
-- Same as append_in but produce only f digit of
-- the fractionnal part.
require
str /= Void;
f >= 0
to_double: DOUBLE
feature(s) from REAL
-- Maths functions:
sqrt: DOUBLE
-- Square root of Current (ANSI C sqrt).
require
Current >= 0
sin: DOUBLE
-- Sine of Current (ANSI C sin).
cos: DOUBLE
-- Cosine of Current (ANSI C cos).
tan: DOUBLE
-- Tangent of Current (ANSI C tan).
asin: DOUBLE
-- Arc Sine of Current (ANSI C asin).
acos: DOUBLE
-- Arc Cosine of Current (ANSI C acos).
atan: DOUBLE
-- Arc Tangent of Current (ANSI C atan).
atan2 (x: DOUBLE): DOUBLE
-- Arc Tangent of Current / x (ANSI C atan2).
sinh: DOUBLE
-- Hyperbolic Sine of Current (ANSI C sinh).
cosh: DOUBLE
-- Hyperbolic Cosine of Current (ANSI C cosh).
tanh: DOUBLE
-- Hyperbolic Tangent of Current (ANSI C tanh).
exp: DOUBLE
-- Exponential of Current (ANSI C exp).
log: DOUBLE
-- Natural Logarithm of Current (ANSI C log).
log10: DOUBLE
-- Base-10 Logarithm of Current (ANSI C log10).
pow (e: DOUBLE): DOUBLE
-- Current raised to the power of e (ANSI C pow).
feature(s) from REAL
-- Object Printing:
out_in_tagged_out_memory
-- Append terse printable represention of current object
-- in tagged_out_memory.
ensure
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
-- Append terse printable represention of current object
-- in tagged_out_memory.
feature(s) from REAL
-- For compatibility with the obsolete REAL_REF style:
item: REAL
set_item (value: like item)
ensure
item = value
end of expanded REAL
All classes inherit from ANY, ANY inherits from
PLATFORM
and PLATFORM inherits from GENERAL.
Generated by short -html_deb on 31 March 2005.