G.2.6 Accuracy Requirements for Complex Arithmetic
In the strict mode, the performance of Numerics.Generic_Complex_Types and Numerics.Generic_Complex_Elementary_Functions shall be as specified here.
Implementation Requirements
When an exception is not raised, the result of evaluating a real function of an instance CT of Numerics.Generic_Complex_Types (i.e., a function that yields a value of subtype CT.Real'Base or CT.Imaginary) belongs to a result interval defined as for a real elementary function (see G.2.4).
When an exception is not raised, each component of the result of evaluating a complex function of such an instance, or of an instance of Numerics.Generic_Complex_Elementary_Functions obtained by instantiating the latter with CT (i.e., a function that yields a value of subtype CT.Complex), also belongs to a result interval. The result intervals for the components of the result are either defined by a maximum relative error bound or by a maximum box error bound. When the result interval for the real (resp., imaginary) component is defined by maximum relative error, it is defined as for that of a real function, relative to the exact value of the real (resp., imaginary) part of the result of the corresponding mathematical function. When defined by maximum box error, the result interval for a component of the result is the smallest model interval of CT.Real that contains all the values of the corresponding part of f · (1.0 + d), where f is the exact complex value of the corresponding mathematical function at the given parameter values, d is complex, and |d| is less than or equal to the given maximum box error. The function delivers a value that belongs to the result interval (or a value both of whose components belong to their respective result intervals) when both bounds of the result interval(s) belong to the safe range of CT.Real; otherwise,
- if CT.Real'Machine_Overflows is True, the function either delivers a value that belongs to the result interval (or a value both of whose components belong to their respective result intervals) or raises Constraint_Error, signaling overflow;
- if CT.Real'Machine_Overflows is False, the result is implementation defined.
The error bounds for particular complex functions are tabulated below. In the table, the error bound is given as the coefficient of CT.Real'Model_Epsilon.
This paragraph was deleted.
The maximum relative error given above applies throughout the domain of the Compose_From_Polar function when the Cycle parameter is specified. When the Cycle parameter is omitted, the maximum relative error applies only when the absolute value of the parameter Argument is less than or equal to the angle threshold (see G.2.4). For the Exp function, and for the forward hyperbolic (resp., trigonometric) functions, the maximum relative error given above likewise applies only when the absolute value of the imaginary (resp., real) component of the parameter X (or the absolute value of the parameter itself, in the case of the Exp function with a parameter of pure-imaginary type) is less than or equal to the angle threshold. For larger angles, the accuracy is implementation defined.
Function or Operator | Nature of Result | Nature of Bound | Error Bound |
---|---|---|---|
Modulus | real | max. rel. error | 3.0 |
Argument | real | max. rel. error | 4.0 |
Compose_From_Polar | complex | max. rel. error | 3.0 |
"*" (both operands complex) | complex | max. box error | 5.0 |
"/" (right operand complex) | complex | max. box error | 13.0 |
Sqrt | complex | max. rel. error | 6.0 |
Log | complex | max. box error | 13.0 |
Exp (complex parameter) | complex | max. rel. error | 7.0 |
Exp (imaginary parameter) | complex | max. rel. error | 2.0 |
Sin, Cos, Sinh, and Cosh | complex | max. rel. error | 11.0 |
Tan, Cot, Tanh, and Coth | complex | max. rel. error | 35.0 |
inverse trigonometric | complex | max. rel. error | 14.0 |
inverse hyperbolic | complex | max. rel. error | 14.0 |
The prescribed results specified in G.1.2 for certain functions at particular parameter values take precedence over the error bounds; effectively, they narrow to a single value the result interval allowed by the error bounds for a component of the result. Additional rules with a similar effect are given below for certain inverse trigonometric and inverse hyperbolic functions, at particular parameter values for which a component of the mathematical result is transcendental. In each case, the accuracy rule, which takes precedence over the error bounds, is that the result interval for the stated result component is the model interval of CT.Real associated with the component's exact mathematical value. The cases in question are as follows:
- When the parameter X has the value zero, the real (resp., imaginary) component of the result of the Arccot (resp., Arccoth) function is in the model interval of CT.Real associated with the value PI/2.0.
- When the parameter X has the value one, the real component of the result of the Arcsin function is in the model interval of CT.Real associated with the value PI/2.0.
- When the parameter X has the value -1.0, the real component of the result of the Arcsin (resp., Arccos) function is in the model interval of CT.Real associated with the value -PI/2.0 (resp., PI).
The amount by which a component of the result of an inverse trigonometric or inverse hyperbolic function is allowed to spill over into a quadrant adjacent to the one corresponding to the principal branch, as given in G.1.2, is limited. The rule is that the result belongs to the smallest model interval of CT.Real that contains both boundaries of the quadrant corresponding to the principal branch. This rule also takes precedence to the maximum error bounds, effectively narrowing the result interval allowed by them.
Finally, the results allowed by the error bounds are narrowed by one further rule: The absolute value of each component of the result of the Exp function, for a pure-imaginary parameter, never exceeds one.
Implementation Advice
The version of the Compose_From_Polar function without a Cycle parameter should not be implemented by calling the corresponding version with a Cycle parameter of 2.0*Numerics.Pi, since this will not provide the required accuracy in some portions of the domain.
Copyright © 1992,1993,1994,1995 Intermetrics, Inc.
Copyright © 2000 The MITRE Corporation, Inc.
Ada Reference Manual