note
	description: "[
		Perform arithmetic (+, -, *, /) on real numbers of arbitrary precision.
		In the case of division, the default precision is 35 digits after
		the decimal point. This can be changed via set_division_precision.
		The queries is_integer, is_natural and is_natural1 may be used to
		check that the value is an integer or natural number. 
		out provides a string represesentation rounded to two decimal places, and 
		precise_out is a string representation of the precise value. The corresponding
		C# class was the inspiration for this class.
	]"
	author: "Vlad Gerchikov for the Software Engineering Lab at sel@cse.yorku.ca"
	date: "$April 15, 2008$"
	revision: "$1.0$"

expanded class interface
	VALUE

create 
	make_from_string,
	make,
	make_from_int,
	default_create

convert
	make_from_string ({STRING_8}),
	as_double: {REAL_64}

feature -- comparison

	is_equal (other: VALUE): BOOLEAN
			-- check whether other is equal to current or not

	is_less alias "<" (other: VALUE): BOOLEAN
			-- whether current is less than other
	
feature -- operations

	plus alias "+" (other: VALUE): VALUE
			-- adds current to other and returns a new object
			-- Was declared in VALUE as synonym of add.

	add (other: VALUE): VALUE
			-- adds current to other and returns a new object
			-- Was declared in VALUE as synonym of plus.

	minus alias "-" (other: VALUE): VALUE
			-- subtracts other from current and returns a new object
			-- Was declared in VALUE as synonym of subtract.

	subtract (other: VALUE): VALUE
			-- subtracts other from current and returns a new object
			-- Was declared in VALUE as synonym of minus.

	product alias "*" (other: VALUE): VALUE
			-- multiplies current by other and returns a new object
			-- Was declared in VALUE as synonym of multiply.

	multiply (other: VALUE): VALUE
			-- multiplies current by other and returns a new object
			-- Was declared in VALUE as synonym of product.

	quotient alias "/" (other: VALUE): VALUE
			-- divides current by other and returns a new object
			-- Was declared in VALUE as synonym of divide.

	divide (other: VALUE): VALUE
			-- divides current by other and returns a new object
			-- Was declared in VALUE as synonym of quotient.

	opposite alias "-": VALUE
			-- unary minus

	identity alias "+": VALUE
			-- unary plus

	zero: VALUE
			-- neutral element for "+" and "-"

	one: VALUE
			-- neutral element for "*" and "/"

	divisible (other: VALUE): BOOLEAN
			-- may current object be divided by other?

	exponentiable (other: NUMERIC): BOOLEAN
			-- may current object be elevated to the power other?

	is_natural: BOOLEAN

	is_natural1: BOOLEAN

	is_integer: BOOLEAN

	set_division_precision (i: INTEGER_32)
			-- sets divisionDecimalPrecision_ to 'i'
		require
			greater_than_zero: i > 0
	
feature -- Conversion

	as_double: REAL_64
			-- represent as a DOUBLE
	
feature -- printing

	precise_out: STRING_8
			-- what is the string representation of VALUE_IMP

	out: STRING_8
			-- return a representation of the number rounded to two decimal places
	
feature -- rounding

	round_to (digits: INTEGER_32): VALUE
			-- rounds the current VALUE_IMP to 'digits'
			-- symmetric rounding as in Excel http://support.microsoft.com/kb/196652
			-- -2.6 is rounded to -3
		require
				digits >= 0

	precise_out_to (digits: INTEGER_32): STRING_8
			-- returns the precise string representation to 'digits'
		require
				digits >= 0

	round (digits: INTEGER_32)
			-- rounds this instance to the specified number of digits
		require
				digits >= 0

	negate
			-- negates the number

	Epsilon_singleton: VALUE_SINGLETON

	set_epsilon (v: STRING_8)

	is_imprecise_equal alias "|~" (other: VALUE): BOOLEAN

	is_imprecise_equal_negation alias "|/~" (other: VALUE): BOOLEAN

	is_imprecise_less alias "|<" (other: VALUE): BOOLEAN

	is_imprecise_less_equal alias "|<~" (other: VALUE): BOOLEAN

	is_imprecise_greater alias "|>" (other: VALUE): BOOLEAN

	is_imprecise_greater_equal alias "|>~" (other: VALUE): BOOLEAN

	absolute: VALUE
		ensure
				Result >= Result.zero
	
invariant
		divisiondecimalprecision_ > 0

end -- class VALUE

Generated by ISE EiffelStudio