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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>AARM95 - 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-A-5.html">Previous</A> <A HREF="AA-A-5-2.html">Next</A></P>
<HR>
<H1> A.5.1 Elementary Functions</H1>
<DIV Class="Paranum"><FONT SIZE=-2>1</FONT></DIV>
<DIV Class="Normal"> Implementation-defined approximations to the mathematical
functions known as the ``elementary functions'' are provided by the subprograms
in Numerics.Generic_Elementary_Functions. Nongeneric equivalents of this
generic package for each of the predefined floating point types are also
provided as children of Numerics. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>1.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation defined: </B>The
accuracy actually achieved by the elementary functions.</FONT></DIV>
<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> The generic library
package Numerics.Generic_Elementary_Functions has the following declaration:
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<DIV Class="Examples"><TT><B>generic</B><BR>
<B>type</B> Float_Type <B>is</B> <B>digits</B> <>;<BR>
<A NAME="I5507"></A><A NAME="I5508"></A><A NAME="I5509"></A><BR>
<B>package</B> Ada.Numerics.Generic_Elementary_Functions <B>is</B><BR>
<B>pragma</B> Pure(Generic_Elementary_Functions);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I5510"></A><A NAME="I5511"></A>Sqrt (X : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5512"></A><A NAME="I5513"></A>Log (X : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5514"></A><A NAME="I5515"></A>Log (X, Base : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5516"></A><A NAME="I5517"></A>Exp (X : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> "**" (Left, Right : Float_Type'Base) <B>return</B> Float_Type'Base;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I5518"></A><A NAME="I5519"></A>Sin (X : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5520"></A><A NAME="I5521"></A>Sin (X, Cycle : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5522"></A><A NAME="I5523"></A>Cos (X : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5524"></A><A NAME="I5525"></A>Cos (X, Cycle : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5526"></A><A NAME="I5527"></A>Tan (X : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5528"></A><A NAME="I5529"></A>Tan (X, Cycle : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5530"></A><A NAME="I5531"></A>Cot (X : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5532"></A><A NAME="I5533"></A>Cot (X, Cycle : Float_Type'Base) <B>return</B> Float_Type'Base;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I5534"></A><A NAME="I5535"></A>Arcsin (X : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5536"></A><A NAME="I5537"></A>Arcsin (X, Cycle : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5538"></A><A NAME="I5539"></A>Arccos (X : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5540"></A><A NAME="I5541"></A>Arccos (X, Cycle : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5542"></A><A NAME="I5543"></A>Arctan (Y : Float_Type'Base;<BR>
X : Float_Type'Base := 1.0)<BR>
<B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5544"></A><A NAME="I5545"></A>Arctan (Y : Float_Type'Base;<BR>
X : Float_Type'Base := 1.0;<BR>
Cycle : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5546"></A><A NAME="I5547"></A>Arccot (X : Float_Type'Base;<BR>
Y : Float_Type'Base := 1.0)<BR>
<B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5548"></A><A NAME="I5549"></A>Arccot (X : Float_Type'Base;<BR>
Y : Float_Type'Base := 1.0;<BR>
Cycle : Float_Type'Base) <B>return</B> Float_Type'Base;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I5550"></A><A NAME="I5551"></A>Sinh (X : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5552"></A><A NAME="I5553"></A>Cosh (X : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5554"></A><A NAME="I5555"></A>Tanh (X : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5556"></A><A NAME="I5557"></A>Coth (X : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5558"></A><A NAME="I5559"></A>Arcsinh (X : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5560"></A><A NAME="I5561"></A>Arccosh (X : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5562"></A><A NAME="I5563"></A>Arctanh (X : Float_Type'Base) <B>return</B> Float_Type'Base;<BR>
<B>function</B> <A NAME="I5564"></A><A NAME="I5565"></A>Arccoth (X : Float_Type'Base) <B>return</B> Float_Type'Base;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<DIV Class="Examples"><TT><B>end</B> Ada.Numerics.Generic_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="I5566"></A><A NAME="I5567"></A><A NAME="I5568"></A><A NAME="I5569"></A>The
library package Numerics.Elementary_Functions <U>is declared pure and
</U>defines the same subprograms as Numerics.Generic_Elementary_Functions,
except that the predefined type Float is systematically substituted for
Float_Type'Base throughout. Nongeneric equivalents of Numerics.Generic_Elementary_Functions
for each of the other predefined floating point types are defined similarly,
with the names Numerics.Short_Elementary_Functions, Numerics.Long_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 functions have their usual mathematical meanings.
When the Base parameter is specified, the Log function computes the logarithm
to the given base; otherwise, it computes the natural logarithm. When
the Cycle parameter is specified, the parameter X of the forward trigonometric
functions (Sin, Cos, Tan, and Cot) and the results of the inverse trigonometric
functions (Arcsin, Arccos, Arctan, and Arccot) are measured in units
such that a full cycle of revolution has the given value; otherwise,
they are measured in radians.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11</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>12</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The results of the Sqrt and Arccosh functions and that
of the exponentiation operator are nonnegative.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>13</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The result of the Arcsin function is in the quadrant containing
the point (1.0, <I>x</I>), where <I>x</I> is the value of the parameter
X. This quadrant is I or IV; thus, the range of the Arcsin function is
approximately -PI/2.0 to PI/2.0 (-Cycle/4.0 to Cycle/4.0, if the parameter
Cycle is specified).</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>14</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The result of the Arccos function is in the quadrant containing
the point (<I>x</I>, 1.0), where <I>x</I> is the value of the parameter
X. This quadrant is I or II; thus, the Arccos function ranges from 0.0
to approximately PI (Cycle/2.0, if the parameter Cycle is specified).</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>15</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The results of the Arctan and Arccot functions are in the
quadrant containing the point (<I>x</I>, <I>y</I>), where <I>x</I> and
<I>y</I> are the values of the parameters X and Y, respectively. This
may be any quadrant (I through IV) when the parameter X (resp., Y) of
Arctan (resp., Arccot) is specified, but it is restricted to quadrants
I and IV (resp., I and II) when that parameter is omitted. Thus, the
range when that parameter is specified is approximately -PI to PI (-Cycle/2.0
to Cycle/2.0, if the parameter Cycle is specified); when omitted, the
range of Arctan (resp., Arccot) is that of Arcsin (resp., Arccos), as
given above. When the point (<I>x</I>, <I>y</I>) lies on the negative
x-axis, the result approximates </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>16</FONT></DIV>
<UL Class="CodeIndentedBulleted"><LI TYPE=DISC>PI (resp., -PI) when the sign of the parameter Y is positive
(resp., negative), if Float_Type'Signed_Zeros is True;</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>17</FONT></DIV>
<UL Class="CodeIndentedBulleted"><LI TYPE=DISC>PI, if Float_Type'Signed_Zeros is False. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>18</FONT></DIV>
<DIV Class="Normal"> (In the case of the inverse trigonometric functions,
in which a result lying on or near one of the axes may not be exactly
representable, the approximation inherent in computing the result may
place it in an adjacent quadrant, close to but on the wrong side of the
axis.) </DIV>
<H4 ALIGN=CENTER>Dynamic Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>19</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> The exception Numerics.Argument_Error
is raised, signaling a parameter value outside the domain of the corresponding
mathematical function, in the following cases: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>20</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>by any forward or inverse trigonometric function with specified
cycle, when the value of the parameter Cycle is zero or negative;</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>21</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>by the Log function with specified base, when the value
of the parameter Base is zero, one, or negative;</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>22</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>by the Sqrt and Log functions, when the value of the parameter
X is negative;</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>23</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>by the exponentiation operator, when the value of the left
operand is negative or when both operands have the value zero;</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>24</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>by the Arcsin, Arccos, and Arctanh functions, when the
absolute value of the parameter X exceeds one;</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>25</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>by the Arctan and Arccot functions, when the parameters
X and Y both have the value zero;</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>26</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>by the Arccosh function, when the value of the parameter
X is less than one; and</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>27</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>by the Arccoth function, when the absolute value of the
parameter X is less than one. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>28</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> <A NAME="I5570"></A><A NAME="I5571"></A><A NAME="I5572"></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 Float_Type'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 value of the exponent is negative;</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>31</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>by the Tan function with specified cycle, when the value
of the parameter X is an odd multiple of the quarter cycle;</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>32</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>by the Cot function with specified cycle, when the value
of the parameter X is zero or a multiple of the half cycle; and</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>33</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>by the Arctanh and Arccoth functions, when the absolute
value of the parameter X is one. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>34</FONT></DIV>
<DIV Class="Normal"> <A NAME="I5573"></A>[Constraint_Error can also
be raised when a finite result overflows (see <A HREF="AA-G-2-4.html">G.2.4</A>);
this may occur for parameter values sufficiently <I>near</I> poles, and,
in the case of some of the functions, for parameter values with sufficiently
large magnitudes.]<A NAME="I5574"></A> When Float_Type'Machine_Overflows
is False, the result at poles is unspecified. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>34.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>34.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
both the predefined arithmetic operations and implementations of the
elementary functions to deliver signed infinities (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 elementary functions to deliver signed infinities (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 elementary functions, when sensible, given parameters
with infinite values. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>35</FONT></DIV>
<DIV Class="Normal"> When one parameter of a function with multiple
parameters represents a pole and another is outside the function's domain,
the latter takes precedence (i.e., Numerics.Argument_Error is raised).
</DIV>
<H4 ALIGN=CENTER>Implementation Requirements</H4>
<DIV Class="Paranum"><FONT SIZE=-2>36</FONT></DIV>
<DIV Class="Normal"> In the implementation of Numerics.Generic_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
Float_Type. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>36.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation Note: </B>Implementations
of Numerics.Generic_Elementary_Functions written in Ada should therefore
avoid declaring local variables of subtype Float_Type; the subtype Float_Type'Base
should be used instead. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>37</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> <A NAME="I5575"></A>In
the following cases, evaluation of an elementary function shall yield
the <I>prescribed result</I>, provided that the preceding rules do not
call for an exception to be raised: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>38</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>When the parameter X has the value zero, the Sqrt, Sin,
Arcsin, Tan, Sinh, Arcsinh, Tanh, and Arctanh functions yield a result
of zero, and the Exp, Cos, and Cosh functions yield a result of one.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>39</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>When the parameter X has the value one, the Sqrt function
yields a result of one, and the Log, Arccos, and Arccosh functions yield
a result of zero.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>40</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>When the parameter Y has the value zero and the parameter
X has a positive value, the Arctan and Arccot functions yield a result
of zero.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>41</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The results of the Sin, Cos, Tan, and Cot functions with
specified cycle are exact when the mathematical result is zero; those
of the first two are also exact when the mathematical result is ±
1.0.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>42</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.
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</FONT></DIV>
<DIV Class="Normal"> Other accuracy requirements for the elementary
functions, which apply only in implementations conforming to the Numerics
Annex, and then only in the ``strict'' mode defined there (see <A HREF="AA-G-2.html">G.2</A>),
are given in <A HREF="AA-G-2-4.html">G.2.4</A>.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>44</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> When Float_Type'Signed_Zeros
is True, the sign of a zero result shall be as follows: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>45</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>A prescribed zero result delivered <I>at the origin</I>
by one of the odd functions (Sin, Arcsin, Sinh, Arcsinh, Tan, Arctan
or Arccot as a function of Y when X is fixed and positive, Tanh, and
Arctanh) has the sign of the parameter X (Y, in the case of Arctan or
Arccot).</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>46</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>A prescribed zero result delivered by one of the odd functions
<I>away from the origin</I>, or by some other elementary function, has
an implementation-defined sign. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>46.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation defined: </B>The
sign of a zero result from some of the operators or functions in Numerics.Generic_Elementary_Functions,
when Float_Type'Signed_Zeros is True.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>47</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>[A zero result that is not a prescribed result (i.e., one
that results from rounding or underflow) has the correct mathematical
sign.] </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>47.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>This is a consequence
of the rules specified in IEC 559:1989 as they apply to underflow situations
with traps disabled. </FONT></DIV>
<H4 ALIGN=CENTER>Implementation Permissions</H4>
<DIV Class="Paranum"><FONT SIZE=-2>48</FONT></DIV>
<DIV Class="Normal"> The nongeneric equivalent packages may, but need
not, be actual instantiations of the generic package for the appropriate
predefined type. </DIV>
<H4 ALIGN=CENTER>Wording Changes from Ada 83</H4>
<DIV Class="Paranum"><FONT SIZE=-2>48.a</FONT></DIV>
<DIV Class="Annotations" Style="margin-bottom: 0.4em"><FONT SIZE=-1>The
semantics of Numerics.Generic_Elementary_Functions differs from Generic_Elementary_Functions
as defined in ISO/IEC DIS 11430 (for Ada 83) in the following ways: </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>48.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>48.c</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>DIS 11430 specified names for the nongeneric equivalents,
if provided. Here, those nongeneric equivalents are required.</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>48.d</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>Implementations are not allowed to impose an optional restriction
that the generic actual parameter associated with Float_Type be unconstrained.
(In view of the ability to declare variables of subtype Float_Type'Base
in implementations of Numerics.Generic_Elementary_Functions, this flexibility
is no longer needed.)</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>48.e</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>The sign of a prescribed zero result at the origin of the
odd functions is specified, when Float_Type'Signed_Zeros is True. This
conforms with recommendations of Kahan and other numerical analysts.</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>48.f</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>The dependence of Arctan and Arccot on the sign of a parameter
value of zero is tied to the value of Float_Type'Signed_Zeros.</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>48.g</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>Sqrt is prescribed to yield a result of one when its parameter
has the value one. This guarantee makes it easier to achieve certain
prescribed results of the complex elementary functions (see <A HREF="AA-G-1-2.html">G.1.2</A>,
``<A HREF="AA-G-1-2.html">Complex Elementary Functions</A>'').</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>48.h</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-A-5.html">Previous</A> <A HREF="AA-A-5-2.html">Next</A> <A HREF="AA-TTL.html">Legal</A></P>
</BODY>
</HTML>
|