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 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>AARM95 - Complex Elementary Functions</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="AA-TOC.html">Contents</A> <A HREF="AA-0-29.html">Index</A> <A HREF="AA-G-1-1.html">Previous</A> <A HREF="AA-G-1-3.html">Next</A></P>
<HR>
<H1> G.1.2 Complex Elementary Functions</H1>
<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>1</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> The generic library
package Numerics.Generic_Complex_Elementary_Functions has the following
declaration: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<DIV Class="Examples"><TT><B>with</B> Ada.Numerics.Generic_Complex_Types;<BR>
<B>generic</B><A NAME="I7173"></A><A NAME="I7174"></A><A NAME="I7175"></A><BR>
<B>with</B> <B>package</B> Complex_Types <B>is</B><BR>
<B>new</B> Ada.Numerics.Generic_Complex_Types (<>);<BR>
<B>use</B> Complex_Types;<BR>
<B>package</B> Ada.Numerics.Generic_Complex_Elementary_Functions <B>is</B><BR>
pragma Pure(Generic_Complex_Elementary_Functions);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I7176"></A><A NAME="I7177"></A>Sqrt (X : Complex) <B>return</B> Complex;<BR>
<B>function</B> <A NAME="I7178"></A><A NAME="I7179"></A>Log (X : Complex) <B>return</B> Complex;<BR>
<B>function</B> <A NAME="I7180"></A><A NAME="I7181"></A>Exp (X : Complex) <B>return</B> Complex;<BR>
<B>function</B> <A NAME="I7182"></A><A NAME="I7183"></A>Exp (X : Imaginary) <B>return</B> Complex;<BR>
<B>function</B> "**" (Left : Complex; Right : Complex) <B>return</B> Complex;<BR>
<B>function</B> "**" (Left : Complex; Right : Real'Base) <B>return</B> Complex;<BR>
<B>function</B> "**" (Left : Real'Base; Right : Complex) <B>return</B> Complex;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I7184"></A><A NAME="I7185"></A>Sin (X : Complex) <B>return</B> Complex;<BR>
<B>function</B> <A NAME="I7186"></A><A NAME="I7187"></A>Cos (X : Complex) <B>return</B> Complex;<BR>
<B>function</B> <A NAME="I7188"></A><A NAME="I7189"></A>Tan (X : Complex) <B>return</B> Complex;<BR>
<B>function</B> <A NAME="I7190"></A><A NAME="I7191"></A>Cot (X : Complex) <B>return</B> Complex;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I7192"></A><A NAME="I7193"></A>Arcsin (X : Complex) <B>return</B> Complex;<BR>
<B>function</B> <A NAME="I7194"></A><A NAME="I7195"></A>Arccos (X : Complex) <B>return</B> Complex;<BR>
<B>function</B> <A NAME="I7196"></A><A NAME="I7197"></A>Arctan (X : Complex) <B>return</B> Complex;<BR>
<B>function</B> <A NAME="I7198"></A><A NAME="I7199"></A>Arccot (X : Complex) <B>return</B> Complex;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I7200"></A><A NAME="I7201"></A>Sinh (X : Complex) <B>return</B> Complex;<BR>
<B>function</B> <A NAME="I7202"></A><A NAME="I7203"></A>Cosh (X : Complex) <B>return</B> Complex;<BR>
<B>function</B> <A NAME="I7204"></A><A NAME="I7205"></A>Tanh (X : Complex) <B>return</B> Complex;<BR>
<B>function</B> <A NAME="I7206"></A><A NAME="I7207"></A>Coth (X : Complex) <B>return</B> Complex;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I7208"></A><A NAME="I7209"></A>Arcsinh (X : Complex) <B>return</B> Complex;<BR>
<B>function</B> <A NAME="I7210"></A><A NAME="I7211"></A>Arccosh (X : Complex) <B>return</B> Complex;<BR>
<B>function</B> <A NAME="I7212"></A><A NAME="I7213"></A>Arctanh (X : Complex) <B>return</B> Complex;<BR>
<B>function</B> <A NAME="I7214"></A><A NAME="I7215"></A>Arccoth (X : Complex) <B>return</B> Complex;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<DIV Class="Examples"><TT><B>end</B> Ada.Numerics.Generic_Complex_Elementary_Functions;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9/1</FONT></DIV>
<DIV Class="Normal"> {<I><A HREF="defect1.html#8652/0020">8652/0020</A></I>}
<A NAME="I7216"></A><A NAME="I7217"></A><A NAME="I7218"></A><A NAME="I7219"></A>The
library package Numerics.Complex_Elementary_Functions <U>is declared
pure and </U>defines the same subprograms as Numerics.Generic_Complex_Elementary_Functions,
except that the predefined type Float is systematically substituted for
Real'Base, and the Complex and Imaginary types exported by Numerics.Complex_Types
are systematically substituted for Complex and Imaginary, throughout.
Nongeneric equivalents of Numerics.Generic_Complex_Elementary_Functions
corresponding to each of the other predefined floating point types are
defined similarly, with the names Numerics.Short_Complex_Elementary_Functions,
Numerics.Long_Complex_Elementary_Functions, etc. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>The nongeneric
equivalents are provided to allow the programmer to construct simple
mathematical applications without being required to understand and use
generics. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10</FONT></DIV>
<DIV Class="Normal"> The overloading of the Exp function for the pure-imaginary
type is provided to give the user an alternate way to compose a complex
value from a given modulus and argument. In addition to Compose_From_Polar(Rho,
Theta) (see <A HREF="AA-G-1-1.html">G.1.1</A>), the programmer may write
Rho * Exp(i * Theta).</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11</FONT></DIV>
<DIV Class="Normal"> The imaginary (resp., real) component of the
parameter X of the forward hyperbolic (resp., trigonometric) functions
and of the Exp function (and the parameter X, itself, in the case of
the overloading of the Exp function for the pure-imaginary type) represents
an angle measured in radians, as does the imaginary (resp., real) component
of the result of the Log and inverse hyperbolic (resp., trigonometric)
functions.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>12</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> The functions have
their usual mathematical meanings. However, the arbitrariness inherent
in the placement of branch cuts, across which some of the complex elementary
functions exhibit discontinuities, is eliminated by the following conventions:
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>13</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The imaginary component of the result of the Sqrt and Log
functions is discontinuous as the parameter X crosses the negative real
axis.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>14</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The result of the exponentiation operator when the left
operand is of complex type is discontinuous as that operand crosses the
negative real axis.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>15</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The real (resp., imaginary) component of the result of
the Arcsin and Arccos (resp., Arctanh) functions is discontinuous as
the parameter X crosses the real axis to the left of -1.0 or the right
of 1.0.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>16</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The real (resp., imaginary) component of the result of
the Arctan (resp., Arcsinh) function is discontinuous as the parameter
X crosses the imaginary axis below -<I>i</I> or above <I>i</I>.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>17</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The real component of the result of the Arccot function
is discontinuous as the parameter X crosses the imaginary axis between
-<I>i</I> and <I>i</I>.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>18</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The imaginary component of the Arccosh function is discontinuous
as the parameter X crosses the real axis to the left of 1.0.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>19</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The imaginary component of the result of the Arccoth function
is discontinuous as the parameter X crosses the real axis between -1.0
and 1.0. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>20</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> The computed results
of the mathematically multivalued functions are rendered single-valued
by the following conventions, which are meant to imply the principal
branch: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>21</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The real component of the result of the Sqrt and Arccosh
functions is nonnegative.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>22</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The same convention applies to the imaginary component
of the result of the Log function as applies to the result of the natural-cycle
version of the Argument function of Numerics.Generic_Complex_Types (see
<A HREF="AA-G-1-1.html">G.1.1</A>).</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>23</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The range of the real (resp., imaginary) component of the
result of the Arcsin and Arctan (resp., Arcsinh and Arctanh) functions
is approximately -PI/2.0 to PI/2.0.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>24</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The real (resp., imaginary) component of the result of
the Arccos and Arccot (resp., Arccoth) functions ranges from 0.0 to approximately
PI.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>25</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The range of the imaginary component of the result of the
Arccosh function is approximately -PI to PI. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>26</FONT></DIV>
<DIV Class="Normal"> In addition, the exponentiation operator inherits
the single-valuedness of the Log function. </DIV>
<H4 ALIGN=CENTER>Dynamic Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>27</FONT></DIV>
<DIV Class="Normal"> The exception Numerics.Argument_Error is raised
by the exponentiation operator, signaling a parameter value outside the
domain of the corresponding mathematical function, when the value of
the left operand is zero and the real component of the exponent (or the
exponent itself, when it is of real type) is zero.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>28</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> <A NAME="I7220"></A><A NAME="I7221"></A><A NAME="I7222"></A>The
exception Constraint_Error is raised, signaling a pole of the mathematical
function (analogous to dividing by zero), in the following cases, provided
that Complex_Types.Real'Machine_Overflows is True: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>29</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>by the Log, Cot, and Coth functions, when the value of
the parameter X is zero;</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>30</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>by the exponentiation operator, when the value of the left
operand is zero and the real component of the exponent (or the exponent
itself, when it is of real type) is negative;</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>31</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>by the Arctan and Arccot functions, when the value of the
parameter X is ± <I>i</I>;</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>32</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>by the Arctanh and Arccoth functions, when the value of
the parameter X is ± 1.0. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>33</FONT></DIV>
<DIV Class="Normal"> [Constraint_Error can also be raised when a finite
result overflows (see <A HREF="AA-G-2-6.html">G.2.6</A>); this may occur
for parameter values sufficiently <I>near</I> poles, and, in the case
of some of the functions, for parameter values having components of sufficiently
large magnitude.] <A NAME="I7223"></A>When Complex_Types.Real'Machine_Overflows
is False, the result at poles is unspecified. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>33.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>The purpose of
raising Constraint_Error (rather than Numerics.Argument_Error) at the
poles of a function, when Float_Type'Machine_Overflows is True, is to
provide continuous behavior as the actual parameters of the function
approach the pole and finally reach it. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>33.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>It is anticipated
that an Ada binding to IEC 559:1989 will be developed in the future.
As part of such a binding, the Machine_Overflows attribute of a conformant
floating point type will be specified to yield False, which will permit
implementations of the complex elementary functions to deliver results
with an infinite component (and set the overflow flag defined by the
binding) instead of raising Constraint_Error in overflow situations,
when traps are disabled. Similarly, it is appropriate for the complex
elementary functions to deliver results with an infinite component (and
set the zero-divide flag defined by the binding) instead of raising Constraint_Error
at poles, when traps are disabled. Finally, such a binding should also
specify the behavior of the complex elementary functions, when sensible,
given parameters with infinite components. </FONT></DIV>
<H4 ALIGN=CENTER>Implementation Requirements</H4>
<DIV Class="Paranum"><FONT SIZE=-2>34</FONT></DIV>
<DIV Class="Normal"> In the implementation of Numerics.Generic_Complex_Elementary_Functions,
the range of intermediate values allowed during the calculation of a
final result shall not be affected by any range constraint of the subtype
Complex_Types.Real. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>34.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation Note: </B>Implementations
of Numerics.Generic_Complex_Elementary_Functions written in Ada should
therefore avoid declaring local variables of subtype Complex_Types.Real;
the subtype Complex_Types.Real'Base should be used instead. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>35</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> <A NAME="I7224"></A>In
the following cases, evaluation of a complex elementary function shall
yield the <I>prescribed result</I> (or a result having the prescribed
component), provided that the preceding rules do not call for an exception
to be raised: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>36</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>When the parameter X has the value zero, the Sqrt, Sin,
Arcsin, Tan, Arctan, Sinh, Arcsinh, Tanh, and Arctanh functions yield
a result of zero; the Exp, Cos, and Cosh functions yield a result of
one; the Arccos and Arccot functions yield a real result; and the Arccoth
function yields an imaginary result.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>37</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>When the parameter X has the value one, the Sqrt function
yields a result of one; the Log, Arccos, and Arccosh functions yield
a result of zero; and the Arcsin function yields a real result.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>38</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>When the parameter X has the value -1.0, the Sqrt function
yields the result </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>39</FONT></DIV>
<UL Class="NestedBulleted"><LI TYPE=DISC><I>i</I> (resp., -<I>i</I>), when the sign of the imaginary
component of X is positive (resp., negative), if Complex_Types.Real'Signed_Zeros
is True;</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>40</FONT></DIV>
<UL Class="NestedBulleted"><LI TYPE=DISC><I>i</I>, if Complex_Types.Real'Signed_Zeros is False;
</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>41</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>the Log function yields an imaginary result; and the Arcsin
and Arccos functions yield a real result.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>42</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>When the parameter X has the value ± <I>i</I>, the
Log function yields an imaginary result.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>43</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>Exponentiation by a zero exponent yields the value one.
Exponentiation by a unit exponent yields the value of the left operand
(as a complex value). Exponentiation of the value one yields the value
one. Exponentiation of the value zero yields the value zero. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>43.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>It is possible
to give many other prescribed results restricting the result to the real
or imaginary axis when the parameter X is appropriately restricted to
easily testable portions of the domain. We follow the proposed ISO/IEC
standard for Generic_Complex_Elementary_Functions (for Ada 83), CD 13813,
in not doing so, however. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>44</FONT></DIV>
<DIV Class="Normal"> Other accuracy requirements for the complex elementary
functions, which apply only in the strict mode, are given in <A HREF="AA-G-2-6.html">G.2.6</A>.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>45</FONT></DIV>
<DIV Class="Normal"> The sign of a zero result or zero result component
yielded by a complex elementary function is implementation defined when
Complex_Types.Real'Signed_Zeros is True. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>45.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation defined: </B>The
sign of a zero result (or a component thereof) from any operator or function
in Numerics.Generic_Complex_Elementary_Functions, when Complex_Types.Real'Signed_Zeros
is True.</FONT></DIV>
<H4 ALIGN=CENTER>Implementation Permissions</H4>
<DIV Class="Paranum"><FONT SIZE=-2>46</FONT></DIV>
<DIV Class="Normal"> The nongeneric equivalent packages may, but need
not, be actual instantiations of the generic package with the appropriate
predefined nongeneric equivalent of Numerics.Generic_Complex_Types; if
they are, then the latter shall have been obtained by actual instantiation
of Numerics.Generic_Complex_Types.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>47</FONT></DIV>
<DIV Class="Normal"> The exponentiation operator may be implemented
in terms of the Exp and Log functions. Because this implementation yields
poor accuracy in some parts of the domain, no accuracy requirement is
imposed on complex exponentiation.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>48</FONT></DIV>
<DIV Class="Normal"> <A NAME="I7225"></A>The implementation of the
Exp function of a complex parameter X is allowed to raise the exception
Constraint_Error, signaling overflow, when the real component of X exceeds
an unspecified threshold that is approximately log(Complex_Types.Real'Safe_Last).
This permission recognizes the impracticality of avoiding overflow in
the marginal case that the exponential of the real component of X exceeds
the safe range of Complex_Types.Real but both components of the final
result do not. Similarly, the Sin and Cos (resp., Sinh and Cosh) functions
are allowed to raise the exception Constraint_Error, signaling overflow,
when the absolute value of the imaginary (resp., real) component of the
parameter X exceeds an unspecified threshold that is approximately log(Complex_Types.Real'Safe_Last)
+ log(2.0). <A NAME="I7226"></A>This permission recognizes the impracticality
of avoiding overflow in the marginal case that the hyperbolic sine or
cosine of the imaginary (resp., real) component of X exceeds the safe
range of Complex_Types.Real but both components of the final result do
not. </DIV>
<H4 ALIGN=CENTER>Implementation Advice</H4>
<DIV Class="Paranum"><FONT SIZE=-2>49</FONT></DIV>
<DIV Class="Normal"> Implementations in which Complex_Types.Real'Signed_Zeros
is True should attempt to provide a rational treatment of the signs of
zero results and result components. For example, many of the complex
elementary functions have components that are odd functions of one of
the parameter components; in these cases, the result component should
have the sign of the parameter component at the origin. Other complex
elementary functions have zero components whose sign is opposite that
of a parameter component at the origin, or is always positive or always
negative. </DIV>
<H4 ALIGN=CENTER>Wording Changes from Ada 83</H4>
<DIV Class="Paranum"><FONT SIZE=-2>49.a</FONT></DIV>
<DIV Class="Annotations" Style="margin-bottom: 0.4em"><FONT SIZE=-1>The
semantics of Numerics.Generic_Complex_Elementary_Functions differs from
Generic_Complex_Elementary_Functions as defined in ISO/IEC CD 13814 (for
Ada 83) in the following ways: </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>49.b</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>The generic package is a child unit of the package defining
the Argument_Error exception.</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>49.c</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>The proposed Generic_Complex_Elementary_Functions standard
(for Ada 83) specified names for the nongeneric equivalents, if provided.
Here, those nongeneric equivalents are required.</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>49.d</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>The generic package imports an instance of Numerics.Generic_Complex_Types
rather than a long list of individual types and operations exported by
such an instance.</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>49.e</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>The dependence of the imaginary component of the Sqrt and
Log functions on the sign of a zero parameter component is tied to the
value of Complex_Types.Real'Signed_Zeros.</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>49.f</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>Conformance to accuracy requirements is conditional. </LI></FONT></UL>
<HR>
<P><A HREF="AA-TOC.html">Contents</A> <A HREF="AA-0-29.html">Index</A> <A HREF="AA-G-1-1.html">Previous</A> <A HREF="AA-G-1-3.html">Next</A> <A HREF="AA-TTL.html">Legal</A></P>
</BODY>
</HTML>
|