INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

title: "Reference class for DOUBLE."
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 DOUBLE_REF
inherit

HASHABLE
undefine
is_equal
redefine
out
end

NUMERIC
undefine
is_equal
redefine
out
end

COMPARABLE
redefine
out
end
feature -- Access

item: DOUBLE

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

set_item (d: DOUBLE)
-- Make 'd' the associated double value
ensure
item_set: item = d
feature -- Comparison

infix "<" (other: like Current): BOOLEAN
-- Is current double less than 'other'?
-- (From COMPARABLE)

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, use divisible"

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.item + 5.0e-1).floor

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

truncated_to_real: REAL
-- Real 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 double 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 double value
-- (From GENERAL)
end -- class DOUBLE_REF

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES