CVS difference for ais/ai-00315.txt

Differences between 1.2 and version 1.3
Log of other versions for file ais/ai-00315.txt

--- ais/ai-00315.txt	2003/05/24 00:51:42	1.2
+++ ais/ai-00315.txt	2003/11/27 02:01:15	1.3
@@ -1,15 +1,213 @@
-!standard A.5.3 (00)                                   02-09-30  AI95-00315/00
+!standard A.5.3 (00)                                   03-11-04  AI95-00315/01
 !class amendment 02-09-30
 !status received 02-09-26
 !priority Low
 !difficulty Medium
-!subject Full support for IEEE 754
+!subject Full support for IEC 559:1989
+A new mode, named IEEE mode, is defined to provide support for IEC 559:1989
+The IEEE mode is a mode "stricter than strict". That is, all the requirements
+for strict mode apply, plus some others. It is unspecified which mode is the
+default, if the three modes actually differ, and how the user selects a
+particular mode.
+In the IEEE mode, Interfaces.IEEE_Float_32 must be present. Other types in
+Interfaces, e.g. IEEE_Float_64, must be present if *fully* supported by the
+hardware. By *fully* supported, we mean that all the requirements of IEC
+559:1989, with the possible exception of those pertaining to binary <-> decimal
+conversions, are satisfied by the underlying hardware. If a format is supported
+by the hardware, but some of its operations trap to software, we do not require
+the existence of a corresponding type in Interfaces.
+Float must be functionally equivalent to IEEE_Float_32. If Long_Float and
+IEEE_Float_64 both exist, they must be functionally equivalent. The attributes
+of IEEE_Float_32 and IEEE_Float_64, if present, must have the value specified in
+AARM G.2.2(11.a-g) (with Signed_Zeros = True).
+The permission of G.2.1(16) does not apply. Furthermore, the accuracy rules in
+G.2.1(7-8) apply to the function Sqrt in any instantiation of
+The value returned by Sqrt (-0.0) must be -0.0. No exception is raised in this
+The attributes Image and Value and the procedures Put and Get in any
+instantiation of Ada.Text_IO.Float_IO comply with the following accuracy
+o  If the argument has the form M * 10.0 ** N where M is an integer in the range
+   -Max_M .. Max_M and N is an integer in the range -Max_N .. Max_N, then the
+   conversion is exact.
+o  Otherwise if the rounding mode is Round_To_Nearest the error of the converted
+   result does not exceed by more than 0.47 units in the destination's least
+   significant digit the error that would be incurred by rounding to the nearest
+   value, provided that overflow/underflow does not occur.
+o  In the directed rounding modes the error has the correct sign and does not
+   exceed 1.47 units of the last place.
+Max_M is 1E9 - 1 for IEEE_Float_32 and 1E17 - 1 for IEEE_Float_64. Max_N is 13
+for IEEE_Float_32 and 27 for IEEE_Float_64.
+Image, Value, Put and Get are monotonic. If the rounding mode is
+Round_To_Nearest applying Image followed by Value, or Put followed by Get, is
+the identity as long as the strings have at least 9 significant digits for
+IEEE_Float_32 and 17 significant digits for IEEE_Float_64.
+The operators "<=", "<", "=", ">", ">=" for a floating-point type return False
+in the unordered case. The operator "/=" returns True in the unordered case.
+(Note that this means that 'not (X < Y)' may be distinct from 'X >= Y'.
+Optimizers, beware!)
+The arithmetic operators properly operate on NaNs and infinities, and comply
+with the current rounding mode.
+For every subtype S of a floating-point type T, the following additional
+attributes are defined:
+   S'Infinity        returns a value of type T that represents +oo.
+   S'Quiet_NaN       returns a value of type T that is a quiet NaN; if the
+                     hardware supports several representations for quiet NaNs,
+                     it is implementation defined which one is returned by this
+                     attribute.
+   S'Signalling_NaN  returns a value of type T that is a signalling NaN; if the
+                     hardware supports several representations for signalling
+                     NaNs, it is implementation defined which one is returned by
+                     this attribute.
+   S'Is_NaN          A function with the specification:
+                        function S'Is_NaN (X : T) return Boolean;
+                     returns True if X is a quiet or signalling NaN.
+   S'Finite          A function with the specification:
+                        function S'Finite (X : T) return Boolean;
+                     returns True if X is neither an infinity nor a NaN.
+   S'Unordered       A function with the specification:
+                        function S'Unordered (X, Y : T) return Boolean;
+                     returns True if X and Y are unordered.
+All these attributes are static if their prefix and arguments (if any) are.
+The following predefined package is added:
+package Ada.Numerics.IEEE is
+   type Rounding_Mode is (Round_To_Nearest,
+                          Round_Towards_Zero,
+                          Round_Up,
+                          Round_Down);
+   procedure Set_Rounding_Mode (R : Rounding_Mode);
+   function Get_Rounding_Mode return Rounding_Mode;
+   type Format is (Single,
+                   Single_Extended,
+                   Double,
+                   Double_Extended);
+   procedure Set_Rounding_Precision (F : Format);
+   function Get_Rounding_Precision return Format;
+   -- The following is called "exception" by IEC 559:1989...
+   type Event is (Invalid_Operation,
+                  Division_By_Zero,
+                  Overflow,
+                  Underflow,
+                  Inexact);
+   procedure Set_Flag (E : Event; To : Boolean);
+   function Get_Flag (E : Event) return Boolean;
+   type Flags is array (Event) of Boolean;
+   procedure Set_Flags (F : Flags);
+   function Get_Flags return Flags;
+   -- Is this the right level of granularity?
+   type Operation is (Add,
+                      Subtract,
+                      Multiply,
+                      Divide,
+                      Remainder,
+                      Sqrt,
+                      Float_Float_Conversion,
+                      Float_Integer_Conversion,
+                      Integer_Float_Conversion,
+                      Rounding,
+                      Binary_Decimal_Conversion,
+                      Decimal_Binary_Conversion,
+                      Comparison);
+   generic
+      type T is digits <>;
+   package Traps is
+      type Handler is access function (E : Event;
+                                       Op : Operation;
+                                       Fmt : Format;
+                                       Result : T;
+                                       Arg1, Arg2 : T) return T;
+      procedure Enable_Trap (H : Handler; E : Event);
+      procedure Disable_Trap (E : Event);
+      function Trap_Is_Enabled (E : Event) return Boolean;
+      function Get_Handler (E : Event) return Handler;
+   end Traps;
+end Ada.Numerics.IEEE;
+This package operates on global, system-wide state that is modified or used by
+a variety of floating-point operations. Only basic facilities are provided
+here. It is expected that more elaborate facilities can be built as needed by
+the user (e.g using protected objects to deal with race conditions or
+controlled objects to protect against aborts.)
+The rounding mode specifies how arithmetic operations round the (infinitely
+precise) mathematical result to the destination format. When a partition
+starts, the rounding mode is Round_To_Nearest.
+Some machines (e.g. the x86 family) always operate on an extended
+floating-point format. The rounding precision makes it possible to reduce the
+precision of the computations. This is important to avoid double rounding in
+precision-reducing operations. Set_Rounding_Precision has no effect on hardware
+that perform all computations in the destination format. When a partition
+starts, the rounding precision must correspond to the most precise supported
+Events (called exceptions in IEC 559:1989, but we cannot use that name)
+describe conditions that may happen as part of some floating-point operation.
+Event flags may be read/written either one by one or as a whole.
+An event may cause a trap. If it doesn't cause a trap, execution proceeds
+normally. If it causes a trap, the corresponding handler is called. IEC
+559:1989 describes the arguments that are passed to the handler. The value of
+Result, Arg1 and Arg2 are converted to type T before calling the handler. This
+conversion never causes a trap (although it may result in infinities being
+passed to the handler). If some of the arguments Result, Arg1 and Arg2 are not
+relevant for a given event, the value T'Quiet_NaN is passed to the handler.
+The handler may return a value, in which case execution proceeds as if this
+value had been the actual result of the operation.
+The value null for a handler represents the Ada default, which is to ignore
+Underflow and Inexact, raise Constraint_Error on Division_By_Zero and Overflow,
+and is unspecified for Invalid_Operation. The Ada default is in effect when a
+partition starts.
+The correspondence between Ada operations and IEEE operations is unspecified.
+Therefore, relying on the operation passed to the handler may be unreliable,
+unless code statements are used.

Questions? Ask the ACAA Technical Agent