INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

title: "Reference class for REAL."
project: "Eiffel Kernel Library"
revision: "$Revision: 1.1 $"
copyright: "Copyright (C) 1996-2005 Object Tools Group"
license: "http://visual-eiffel.com/license"
cluster: kernel
class REAL_REF
inherit

HASHABLE
undefine
is_equal
redefine
out
end

COMPARABLE
redefine
out
end

NUMERIC
undefine
is_equal
redefine
out
end
feature -- Access

item: REAL

hash_code: INTEGER
-- Hash code value
-- (From HASHABLE)
feature -- Comparison

infix "<" (other: like Current): BOOLEAN
-- Is current real less than 'other'?
-- (From COMPARABLE)
feature -- Element change

set_item (r: REAL)
-- Make 'r' the associated real value
ensure
item_set: item = r

one: like Current
-- Neutral element for "*" and "/"
-- (From NUMERIC)
ensure
value: Result.item = 1.0

sign: INTEGER
-- Sign value (0, -1 or 1)
ensure
three_way: Result = three_way_comparison (zero)

zero: like Current
-- Neutral element for "+" and "-"
-- (From NUMERIC)
ensure
value: Result.item = 0.0
feature -- Status report

divisible (other: like Current): BOOLEAN
-- May current object be divided by 'other'?
-- (From NUMERIC)
ensure
not_exact_zero: Result implies (other.item /= 0.0)

valid_divisor (other: like Current): BOOLEAN
obsolete "Eiffel/S 1.3 compatibility"

exponentiable (other: DOUBLE): BOOLEAN
-- May current object be elevated to the power 'other'?
-- (From NUMERIC)
feature -- Conversion

ceiling: INTEGER
-- Smallest integral value no smaller than current object
ensure
result_no_smaller: Result >= item
close_enough: Result - item < one.item

floor: INTEGER
-- Greatest integral value no greater than current object
ensure
result_no_greater: Result <= item
close_enough: item - Result < one.item

rounded: INTEGER
-- Rounded integral value
ensure
definition: Result = sign * ((abs + 5.0e-1).floor)

truncated_to_integer: INTEGER
-- Integer part
-- (same sign, largest absolute value no greater than current object's)
feature -- Basic operations

abs: like Current
-- Absolute value
ensure
non_negative: Result >= zero
same_absolute_value: standard_equal (Result, Current) or standard_equal (Result, - Current)

infix "*" (other: like Current): like Current
-- Product by 'other'
-- (From NUMERIC)

infix "+" (other: like Current): like Current
-- Sum with 'other'
-- (From NUMERIC)

infix "-" (other: like Current): like Current
-- Result of subtracting 'other'
-- (From NUMERIC)

infix "/" (other: like Current): like Current
-- Division by 'other'
-- (From NUMERIC)

infix "^" (other: DOUBLE): DOUBLE
-- Current real to the power 'other'
-- (From NUMERIC)

prefix "+": like Current
-- Unary plus
-- (From NUMERIC)

prefix "-": like Current
-- Unary minus
-- (From NUMERIC)
feature -- Output

out: STRING
-- Printable representation of real value
-- (From GENERAL)
end -- class REAL_REF

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES