note description: "Decimal coefficients. They hold the significant digits. Can be seen as arrays of decimal values. Zero-based index. - Index '0' is the least significant digit, - index 'count-'1 is the most significant digit." library: "Gobo Eiffel Decimal Arithmetic Library" copyright: "Copyright (c) 2004, Paul G. Crismer and others" license: "MIT License" date: "$Date: 2016-05-06 19:15:38 +0000 (Fri, 06 May 2016) $" revision: "$Revision: 98678 $" deferred class interface MA_DECIMAL_COEFFICIENT feature -- Access item (index: INTEGER_32): INTEGER_32 -- Item at index require valid_index: valid_index (index) msd_index: INTEGER_32 -- Index of most significant (non-zero) digit ensure msd_index_small_enough: Result < count msd_index_large_enough: Result >= 0 index_of_msd_or_zero: Result > 0 implies item (Result) /= 0 feature -- Measurement count: INTEGER_32 -- Number of decimal digits lower: INTEGER_32 -- Lower index ensure definition: Result = 0 upper: INTEGER_32 -- Upper index ensure definition: Result <= capacity - 1 capacity: INTEGER_32 -- Capacity ensure definition: capacity >= count subcoefficient (index_start, index_end: INTEGER_32): MA_DECIMAL_COEFFICIENT -- Subcoefficient made of digits in range [index_start..index_end] require index_start_big_enough: index_start >= 0 index_end_big_enough: index_end >= index_start index_end_small_enough: index_end <= count - 1 ensure subcoefficient_not_void: Result /= Void feature -- Status report valid_index (index: INTEGER_32): BOOLEAN -- Is index valid ? ensure definition: Result = (index >= 0 and then index < count) is_zero: BOOLEAN -- Is this coefficient only composed of zeros? is_one: BOOLEAN -- Is Current one? ensure definition: Result = (msd_index = 0 and then item (0) = 1) is_significant: BOOLEAN -- Has Current any non-zero digit? ensure definition: Result = not is_zero feature -- Comparison is_less alias "<" (other: like Current): BOOLEAN -- Is Current less than other? is_greater alias ">" (other: like Current): BOOLEAN -- Is Current greater than other? feature -- Duplication to_twin: like Current -- Cloned version of Current ensure twin_not_void: Result /= Void twin_not_current: Result /= Current tiwn_equal_current: Result.is_equal (Current) invariant count_less_or_equal_capacity: count <= capacity count_not_negative: count >= 0 lower_upper_consistent: lower <= upper end -- class MA_DECIMAL_COEFFICIENT
Generated by ISE EiffelStudio