ANY NONE REAL_GENERAL
deferred class interface REAL_GENERAL
   --
   -- (This class is here to prepare the new support for REAL: REAL_32, REAL_64, etc.)
   -- Work in progress. Please, do not use it now. July 7th 2004
   --

feature(s) from HASHABLE
   hash_code: INTEGER
      -- The hash-code value of Current.
      ensure
         good_hash_value: Result >= 0

feature(s) from NUMERIC
   infix "+" (other: like Current): like Current
      -- Sum with other (commutative).

   infix "-" (other: like Current): like Current
      -- Result of substracting other.

   infix "*" (other: like Current): like Current
      -- Product by other.

   infix "/" (other: like Current): NUMERIC
      -- Division by other.
      require
         other /= Void;
         divisible(other)

   prefix "+": like Current
      -- Unary plus of Current.

   prefix "-": like Current
      -- Unary minus of Current.

   divisible (other: like Current): BOOLEAN
      -- May Current be divided by other ?
      require
         other /= Void

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

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

   sign: INTEGER_8
      -- Sign of Current (0 -1 or 1).
      ensure
         -1 <= Result;
         Result <= 1

feature(s) from NUMERIC
   -- For experts only:
   --*** To be removed from numeric in the future.

   item: like Current
      -- Access to the expanded value of Current. (The type of  item is REAL or DOUBLE.)

   set_item (value: like Current)
      ensure
         item = value

feature(s) from COMPARABLE
   is_equal (other: like Current): BOOLEAN
      -- Is other attached to an object considered equal to
      -- current object ?
      require
         other /= Void
      ensure
         generating_type = other.generating_type implies Result = other.is_equal(Current);
         trichotomy: Result = (not (Current < other) and not (other < Current))

   infix "<" (other: like Current): BOOLEAN
      -- Is Current strictly less than other?
      require
         other_exists: other /= Void
      ensure
         asymmetric: Result implies not (other < Current)

   infix "<=" (other: like Current): BOOLEAN
      -- Is Current less than or equal other?
      require
         other_exists: other /= Void
      ensure
         definition: Result = (Current < other or is_equal(other))

   infix ">" (other: like Current): BOOLEAN
      -- Is Current strictly greater than other?
      require
         other_exists: other /= Void
      ensure
         definition: Result = (other < Current)

   infix ">=" (other: like Current): BOOLEAN
      -- Is Current greater than or equal than other?
      require
         other_exists: other /= Void
      ensure
         definition: Result = (other <= Current)

   in_range (lower, upper: like Current): BOOLEAN
      -- Return True if Current is in range [lower..upper]
      ensure
         Result = (Current >= lower and Current <= upper)

   compare (other: like Current): INTEGER
      -- If current object equal to other, 0
      -- if smaller,  -1; if greater, 1.
      require
         other_exists: other /= Void
      ensure
         equal_zero: Result = 0 = is_equal(other);
         smaller_negative: Result = -1 = (Current < other);
         greater_positive: Result = 1 = (Current > other)

   three_way_comparison (other: like Current): INTEGER
      -- If current object equal to other, 0
      -- if smaller,  -1; if greater, 1.
      require
         other_exists: other /= Void
      ensure
         equal_zero: Result = 0 = is_equal(other);
         smaller_negative: Result = -1 = (Current < other);
         greater_positive: Result = 1 = (Current > other)

   min (other: like Current): like Current
      -- Minimum of Current and other.
      require
         other /= Void
      ensure
         Result <= Current and then Result <= other;
         compare(Result) = 0 or else other.compare(Result) = 0

   max (other: like Current): like Current
      -- Maximum of Current and other.
      require
         other /= Void
      ensure
         Result >= Current and then Result >= other;
         compare(Result) = 0 or else other.compare(Result) = 0

feature(s) from REAL_GENERAL
   rounded: INTEGER
      -- Rounded integral value.

   double_floor: DOUBLE
      -- Greatest integral value no greater than Current.

   double_ceiling: DOUBLE
      -- Smallest integral value no smaller than Current.



end of deferred REAL_GENERAL