note
	description: "References to objects containing a double-precision real number"
	library: "Free implementation of ELKS library"
	status: "See notice at end of class."
	legal: "See notice at end of class."
	date: "$Date: 2020-04-15 18:06:04 +0000 (Wed, 15 Apr 2020) $"
	revision: "$Revision: 104046 $"

class interface
	REAL_64_REF

create 
	default_create

feature -- Access

	item: REAL_64
			-- Numeric double value

	hash_code: INTEGER_32
			-- Hash code value

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

	one: like Current
			-- Neutral element for "*" and "/"

	zero: like Current
			-- Neutral element for "+" and "-"

	nan: REAL_64
			-- Representation of not a number (NaN)
		ensure
			is_class: class

	negative_infinity: REAL_64
			-- Representation of negative infinity
		ensure
			is_class: class

	positive_infinity: REAL_64
			-- Representation of positive infinity
		ensure
			is_class: class

	Min_value: REAL_64 = -1.7976931348623157081452e+308

	Max_value: REAL_64 = 1.7976931348623157081452e+308
			-- Minimum and Maximum value hold in item.

	Machine_epsilon: REAL_64 = 2.2204460492503130808473e-016
			-- The difference between 1 and the least value greater than
			-- 1 that is representable in the given floating point type.

	Epsilon: REAL_64 = 2.2250738585072013830903e-308
			-- Minimum normalized positive floating-point number.
	
feature -- Comparison

	is_less alias "<" (other: like Current): BOOLEAN
			-- Is other greater than current double?

	is_equal (other: like Current): BOOLEAN
			-- Is other attached to an object of the same type
			-- as current object and identical to it?
	
feature -- Element change

	set_item (d: REAL_64)
			-- Make d the item value.
	
feature -- Status report

	divisible (other: REAL_64_REF): BOOLEAN
			-- May current object be divided by other?
		ensure then
			not_exact_zero: Result implies (other.item /= 0.0)

	exponentiable (other: NUMERIC): BOOLEAN
			-- May current object be elevated to the power other?
		ensure then
			safe_values: ((other.conforms_to (0) and item /= 0.0) or (other.conforms_to (0.0) and item > 0.0)) implies Result

	is_hashable: BOOLEAN
			-- May current object be hashed?
			-- (True if it is not its type's default.)

	is_nan: BOOLEAN
			-- Is current the representation of nan?

	is_negative_infinity: BOOLEAN
			-- Is current the representation of negative_infinity?

	is_positive_infinity: BOOLEAN
			-- Is current the representation of positive_infinity?
	
feature -- Conversion

	to_reference: REAL_64_REF
			-- Associated reference of Current
		ensure
			to_reference_not_void: Result /= Void

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

	truncated_to_integer_64: INTEGER_64
			-- Integer part (Same sign, largest absolute
			-- value no greater than current object's)

	truncated_to_real: REAL_32
			-- Real part (Same sign, largest absolute
			-- value no greater than current object's)

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

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

	rounded: INTEGER_32
			-- Rounded integral value
		ensure
			definition: Result = sign * (abs + 0.5).floor

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

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

	rounded_real_64: REAL_64
			-- Rounded integral value
		ensure
			definition: Result = sign.to_double * (abs + 0.5).floor_real_64
	
feature -- Basic operations

	abs: REAL_64
			-- Absolute value
		ensure
			non_negative: Result >= 0.0
			same_absolute_value: (Result = item) or (Result = - item)

	plus alias "+" (other: like Current): like Current
			-- Sum with other

	minus alias "-" alias "" (other: like Current): like Current
			-- Result of subtracting other

	product alias "*" alias "×" (other: like Current): like Current
			-- Product with other

	quotient alias "/" alias "÷" (other: like Current): like Current
			-- Division by other

	power alias "^" (other: REAL_64): REAL_64
			-- Current double to the power other

	identity alias "+": like Current
			-- Unary plus

	opposite alias "-" alias "": like Current
			-- Unary minus
	
feature -- Output

	out: STRING_8
			-- Printable representation of double value
	
invariant
	sign_times_abs: not item.is_nan implies sign.to_double * abs = item

note
	copyright: "Copyright (c) 1984-2020, Eiffel Software and others"
	license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
	source: "[
		Eiffel Software
		5949 Hollister Ave., Goleta, CA 93117 USA
		Telephone 805-685-1006, Fax 805-685-6869
		Website http://www.eiffel.com
		Customer support http://support.eiffel.com
	]"

end -- class REAL_64_REF

Generated by ISE EiffelStudio