File: RM-G-2-6.html

package info (click to toggle)
ada-reference-manual 20021112web-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny, sarge
  • size: 18,652 kB
  • ctags: 8,921
  • sloc: makefile: 52; sh: 20
file content (211 lines) | stat: -rw-r--r-- 15,615 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
    <TITLE>Ada95 - Accuracy Requirements for Complex Arithmetic</TITLE>
    <META NAME="Author" CONTENT="JTC1/SC22/WG9/ARG, by Randall Brukardt, ARG Editor">
    <META NAME="GENERATOR" CONTENT="Arm_Form.Exe, Ada Reference Manual generator">
    <STYLE type="text/css">
    DIV.paranum {position: absolute; font-family: Arial, Helvetica, sans-serif; left: 0.5 em; top: auto}
    TT {font-family: "Courier New", monospace}
    DT {display: compact}
    DIV.Normal {font-family: "Times New Roman", Times, serif; margin-bottom: 0.6em}
    DIV.Wide {font-family: "Times New Roman", Times, serif; margin-top: 0.6em; margin-bottom: 0.6em}
    DIV.Annotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
    DIV.WideAnnotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0.6em; margin-bottom: 0.6em}
    DIV.Index {font-family: "Times New Roman", Times, serif}
    DIV.SyntaxSummary {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
    DIV.Notes {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.6em}
    DIV.NotesHeader {font-family: "Times New Roman", Times, serif; margin-left: 2.0em}
    DIV.SyntaxIndented {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
    DIV.Indented {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-bottom: 0.6em}
    DIV.CodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
    DIV.SmallIndented {font-family: "Times New Roman", Times, serif; margin-left:  10.0em; margin-bottom: 0.6em}
    DIV.SmallCodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-bottom: 0.6em}
    DIV.Examples {font-family: "Courier New", monospace; margin-left: 2.0em; margin-bottom: 0.6em}
    DIV.SmallExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left: 7.5em; margin-bottom: 0.6em}
    DIV.IndentedExamples {font-family: "Courier New", monospace; margin-left: 8.0em; margin-bottom: 0.6em}
    DIV.SmallIndentedExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left:  15.0em; margin-bottom: 0.6em}
    UL.Bulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SmallBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SmallNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.IndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.CodeIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.CodeIndentedNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SyntaxIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NotesBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NotesNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    DL.Hanging {font-family: "Times New Roman", Times, serif; margin-top: 0em; margin-bottom: 0.6em}
    DD.Hanging {margin-left: 6.0em}
    DL.IndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.IndentedHanging {margin-left: 2.0em}
    DL.HangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.HangingInBulleted {margin-left: 4.0em}
    DL.SmallHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.SmallHanging {margin-left: 7.5em}
    DL.SmallIndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.SmallIndentedHanging {margin-left: 2.0em}
    DL.SmallHangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.SmallHangingInBulleted {margin-left: 5.0em}
    DL.Enumerated {font-family: "Times New Roman", Times, serif; margin-right: 0.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.Enumerated {margin-left: 2.0em}
    DL.SmallEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.SmallEnumerated {margin-left: 2.5em}
    DL.NestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    DL.SmallNestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    </STYLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFF0" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<P><A HREF="RM-TOC.html">Contents</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-0-29.html">Index</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-G-2-5.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-H.html">Next</A></P>
<HR>
<H1> G.2.6 Accuracy Requirements for Complex Arithmetic</H1>
<DIV Class="Paranum"><FONT SIZE=-2>1</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;In the strict mode, the performance of Numerics.Generic_Complex_Types
and Numerics.Generic_Complex_Elementary_Functions shall be as specified
here. </DIV>

<H4 ALIGN=CENTER>Implementation Requirements</H4>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;When an exception is not raised, the result of
evaluating a real function of an instance <I>CT</I> of Numerics.Generic_Complex_Types
(i.e., a function that yields a value of subtype <I>CT</I>.Real'Base
or <I>CT</I>.Imaginary) belongs to a result interval defined as for a
real elementary function (see <A HREF="RM-G-2-4.html">G.2.4</A>).</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I6990"></A>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 <I>CT</I> (i.e., a function
that yields a value of subtype <I>CT</I>.Complex), also belongs to a
<I>result interval</I>. The result intervals for the components of the
result are either defined by a <I>maximum relative error</I> bound or
by a <I>maximum box error</I> bound. <A NAME="I6991"></A>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. <A NAME="I6992"></A>When
defined by maximum box error, the result interval for a component of
the result is the smallest model interval of <I>CT</I>.Real that contains
all the values of the corresponding part of <I>f</I> &middot; (1.0 +
<I>d</I>), where <I>f</I> is the exact complex value of the corresponding
mathematical function at the given parameter values, <I>d</I> is complex,
and |<I>d</I>| is less than or equal to the given maximum box error.
<A NAME="I6993"></A><A NAME="I6994"></A>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 <I>CT</I>.Real; otherwise,
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC><A NAME="I6995"></A>if <I>CT</I>.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;</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>5</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>if <I>CT</I>.Real'Machine_Overflows is False, the result
is implementation defined. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;The error bounds for particular complex functions
are tabulated below. In the table, the error bound is given as the coefficient
of <I>CT</I>.Real'Model_Epsilon.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7/1</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT SIZE=-1><I>This paragraph was deleted.</I></FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;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 <A HREF="RM-G-2-4.html">G.2.4</A>).
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. </DIV>
<DIV Class="SyntaxIndented"><TABLE frame="border" rules="all" border="2"><CAPTION><B>Error Bounds for Particular Complex Functions</B></CAPTION>
<TR><TH align="center"><B>Function or Operator</B><TH align="center"><B>Nature
of <BR>
Result</B><TH align="center"><B>Nature of <BR>
Bound</B><TH align="center"><B>Error Bound</B>
<TR><TD align="center">Modulus<TD align="center">real<TD align="center">max.
rel. error<TD align="center">3.0
<TR><TD align="center">Argument<TD align="center">real<TD align="center">max.
rel. error<TD align="center">4.0
<TR><TD align="center">Compose_From_Polar<TD align="center">complex<TD align="center">max.
rel. error<TD align="center">3.0
<TR><TD align="center">&quot;*&quot; (both operands complex)<TD align="center">complex<TD align="center">max.
box error<TD align="center">5.0
<TR><TD align="center">&quot;/&quot; (right operand complex)<TD align="center">complex<TD align="center">max.
box error<TD align="center">13.0
<TR><TD align="center">Sqrt<TD align="center">complex<TD align="center">max.
rel. error<TD align="center">6.0
<TR><TD align="center">Log<TD align="center">complex<TD align="center">max.
box error<TD align="center">13.0
<TR><TD align="center">Exp (complex parameter)<TD align="center">complex<TD align="center">max.
rel. error<TD align="center">7.0
<TR><TD align="center">Exp (imaginary parameter)<TD align="center">complex<TD align="center">max.
rel. error<TD align="center">2.0
<TR><TD align="center">Sin, Cos, Sinh, and Cosh<TD align="center">complex<TD align="center">max.
rel. error<TD align="center">11.0
<TR><TD align="center">Tan, Cot, Tanh, and Coth<TD align="center">complex<TD align="center">max.
rel. error<TD align="center">35.0
<TR><TD align="center">inverse trigonometric<TD align="center">complex<TD align="center">max.
rel. error<TD align="center">14.0
<TR><TD align="center">inverse hyperbolic<TD align="center">complex<TD align="center">max.
rel. error<TD align="center">14.0
</TABLE>
</TABLE></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;The prescribed results
specified in <A HREF="RM-G-1-2.html">G.1.2</A> 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 <I>CT</I>.Real associated with the component's exact mathematical
value. The cases in question are as follows: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>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 <I>CT</I>.Real associated with the value
PI/2.0.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>11</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>When the parameter X has the value one, the real component
of the result of the Arcsin function is in the model interval of <I>CT</I>.Real
associated with the value PI/2.0.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>12</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>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 <I>CT</I>.Real associated with the value -PI/2.0 (resp.,
PI). </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>13</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;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 <A HREF="RM-G-1-2.html">G.1.2</A>, is limited.
The rule is that the result belongs to the smallest model interval of
<I>CT</I>.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.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>14</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;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. </DIV>

<H4 ALIGN=CENTER>Implementation Advice</H4>
<DIV Class="Paranum"><FONT SIZE=-2>15</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;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. </DIV>

<HR>
<P><A HREF="RM-TOC.html">Contents</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-0-29.html">Index</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-G-2-5.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-H.html">Next</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-TTL.html">Legal</A></P>
</BODY>
</HTML>