note description: "User selectable parameters and rules which govern the results of decimal arithmetic operations" library: "Gobo Eiffel Decimal Arithmetic Library" copyright: "Copyright (c) 2004, Paul G. Crismer and others" license: "MIT License" date: "$Date: 2019-02-07 22:54:15 +0000 (Thu, 07 Feb 2019) $" revision: "$Revision: 102807 $" class interface MA_DECIMAL_CONTEXT create make_default, make_double, make_extended, make_double_extended, make feature -- Access digits: INTEGER_32 -- Number of digits (precision) to be used for an operation. -- The DECIMAL operators use this value to determine the precision of results. -- Note that leading zeros (in the integer part of a number) are never significant. precision: INTEGER_32 -- Synonym for 'digits' ensure synonym_of_digits: Result = digits rounding_mode: INTEGER_32 -- Rounding algorithm to be used for an operation when non-zero digits have to -- be discarded in order to reduce the precision of a result reason: detachable STRING_8 -- Reason of latest raised signal exponent_limit: INTEGER_32 -- Exponent limit; -- Exponents can range from -exponent_limit through +exponent_limit e_tiny: INTEGER_32 -- Minimum value of the exponent for subnormal numbers feature -- Status report is_flagged (a_signal: INTEGER_32): BOOLEAN -- Is a_signal flagged? require valid_signal: valid_signal (a_signal) is_trapped (a_signal: INTEGER_32): BOOLEAN -- Is a_signal trapped? require valid_signal: valid_signal (a_signal) valid_signal (a_signal: INTEGER_32): BOOLEAN -- Is a_signal a valid one? is_extended: BOOLEAN -- Is current context extended? exception_on_trap: BOOLEAN -- Should an exception be raised when trap occurs? feature -- Element change set_digits (some_digits: INTEGER_32) -- Set digits to some_digits. require some_digits_valid: some_digits >= Minimum_digits and some_digits <= Maximum_digits ensure digits_set: digits = some_digits set_exponent_limit (a_limit: INTEGER_32) -- Set exponent_limit to a_limit. require limit_positive: a_limit >= 0 ensure limit_set: exponent_limit = a_limit enable_exception_on_trap -- Enable exception when trap occurs. disable_exception_on_trap -- Disable exception when trap occurs. enable_trap (a_signal: INTEGER_32) -- Enable trapping of a_signal. require valid_signal: valid_signal (a_signal) ensure trapped_signal: is_trapped (a_signal) disable_trap (a_signal: INTEGER_32) -- Enable trapping of a_signal. require valid_signal: valid_signal (a_signal) ensure not_trapped_signal: not is_trapped (a_signal) set_flag (a_signal: INTEGER_32) -- Flag a_signal. require valid_signal: valid_signal (a_signal) ensure flagged_signal: is_flagged (a_signal) reset_flag (a_signal: INTEGER_32) -- Reset a_signal. require valid_signal: valid_signal (a_signal) ensure unflagged_signal: not is_flagged (a_signal) reset_flags -- Reset all signals to zero. set_rounding_mode (a_mode: INTEGER_32) -- Set rounding_mode to a_mode. require valid_mode: Integer_array_.has (Rounds, a_mode) ensure rounding_mode_set: rounding_mode = a_mode set_extended -- Set is_extended to True. ensure extended: is_extended set_normal -- Set is_extended to False. ensure normal: not is_extended feature -- Conversion out: STRING_8 -- Printable representation feature -- Comparison is_equal (other: like Current): BOOLEAN -- Is other equal to Current? feature -- Basic operations signal (a_signal: INTEGER_32; a_message: STRING_8) -- Raise flag a_signal for a_message reason. require valid_signal: valid_signal (a_signal) a_message_not_void: a_message /= Void ensure flagged_signal: is_flagged (a_signal) reason_set: reason = a_message feature -- Duplication copy (other: like Current) -- Copy other. invariant positive_digits: digits >= 0 rounding_mode_valid: rounding_mode = Round_ceiling or rounding_mode = Round_down or rounding_mode = Round_floor or rounding_mode = Round_half_down or rounding_mode = Round_half_even or rounding_mode = Round_half_up or rounding_mode = Round_unnecessary or rounding_mode = Round_up flags_not_void: flags /= Void flags_lower: flags.lower = Signal_division_by_zero flags_upper: flags.upper = Signal_subnormal traps_not_void: traps /= Void traps_lower: traps.lower = Signal_division_by_zero traps_upper: traps.upper = Signal_subnormal end -- class MA_DECIMAL_CONTEXT
Generated by ISE EiffelStudio