annotate gcc/testsuite/ada/acats/tests/cxa/cxa5a03.a @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 -- CXA5A03.A
kono
parents:
diff changeset
2 --
kono
parents:
diff changeset
3 -- Grant of Unlimited Rights
kono
parents:
diff changeset
4 --
kono
parents:
diff changeset
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
kono
parents:
diff changeset
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
kono
parents:
diff changeset
7 -- unlimited rights in the software and documentation contained herein.
kono
parents:
diff changeset
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
kono
parents:
diff changeset
9 -- this public release, the Government intends to confer upon all
kono
parents:
diff changeset
10 -- recipients unlimited rights equal to those held by the Government.
kono
parents:
diff changeset
11 -- These rights include rights to use, duplicate, release or disclose the
kono
parents:
diff changeset
12 -- released technical data and computer software in whole or in part, in
kono
parents:
diff changeset
13 -- any manner and for any purpose whatsoever, and to have or permit others
kono
parents:
diff changeset
14 -- to do so.
kono
parents:
diff changeset
15 --
kono
parents:
diff changeset
16 -- DISCLAIMER
kono
parents:
diff changeset
17 --
kono
parents:
diff changeset
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
kono
parents:
diff changeset
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
kono
parents:
diff changeset
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
kono
parents:
diff changeset
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
kono
parents:
diff changeset
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
kono
parents:
diff changeset
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
kono
parents:
diff changeset
24 --*
kono
parents:
diff changeset
25 --
kono
parents:
diff changeset
26 -- OBJECTIVE:
kono
parents:
diff changeset
27 -- Check that the functions Tan, Tanh, and Arctanh provide correct
kono
parents:
diff changeset
28 -- results.
kono
parents:
diff changeset
29 --
kono
parents:
diff changeset
30 -- TEST DESCRIPTION:
kono
parents:
diff changeset
31 -- This test examines both the version of Tan, Tanh, and Arctanh
kono
parents:
diff changeset
32 -- the instantiation of the Ada.Numerics.Generic_Elementary_Functions
kono
parents:
diff changeset
33 -- with a type derived from type Float, as well as the preinstantiated
kono
parents:
diff changeset
34 -- version of this package for type Float.
kono
parents:
diff changeset
35 -- Prescribed results, including instances prescribed to raise
kono
parents:
diff changeset
36 -- exceptions, are examined in the test cases. In addition,
kono
parents:
diff changeset
37 -- certain evaluations are performed where the actual function result
kono
parents:
diff changeset
38 -- is compared with the expected result (within an epsilon range of
kono
parents:
diff changeset
39 -- accuracy).
kono
parents:
diff changeset
40 --
kono
parents:
diff changeset
41 -- TEST FILES:
kono
parents:
diff changeset
42 -- The following files comprise this test:
kono
parents:
diff changeset
43 --
kono
parents:
diff changeset
44 -- FXA5A00.A (foundation code)
kono
parents:
diff changeset
45 -- CXA5A03.A
kono
parents:
diff changeset
46 --
kono
parents:
diff changeset
47 --
kono
parents:
diff changeset
48 -- CHANGE HISTORY:
kono
parents:
diff changeset
49 -- 14 Mar 95 SAIC Initial prerelease version.
kono
parents:
diff changeset
50 -- 06 Apr 95 SAIC Corrected errors in context clause references
kono
parents:
diff changeset
51 -- and usage of Cycle parameter.
kono
parents:
diff changeset
52 -- 13 Jun 95 SAIC Incorporated use of Dont_Optimize procedure, and
kono
parents:
diff changeset
53 -- use of Result_Within_Range function overloaded for
kono
parents:
diff changeset
54 -- FXA5A00.New_Float_Type.
kono
parents:
diff changeset
55 -- 29 Jun 98 EDS Protected exception tests by first testing
kono
parents:
diff changeset
56 -- for 'Machine_Overflows
kono
parents:
diff changeset
57 --
kono
parents:
diff changeset
58 --!
kono
parents:
diff changeset
59
kono
parents:
diff changeset
60 with Ada.Numerics.Elementary_Functions;
kono
parents:
diff changeset
61 with Ada.Numerics.Generic_Elementary_Functions;
kono
parents:
diff changeset
62 with FXA5A00;
kono
parents:
diff changeset
63 with Report;
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 procedure CXA5A03 is
kono
parents:
diff changeset
66 begin
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 Report.Test ("CXA5A03", "Check that the functions Tan, Tanh, and " &
kono
parents:
diff changeset
69 "Arctanh provide correct results");
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 Test_Block:
kono
parents:
diff changeset
72 declare
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 use Ada.Numerics;
kono
parents:
diff changeset
75 use FXA5A00;
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 package GEF is new Ada.Numerics.Generic_Elementary_Functions(New_Float);
kono
parents:
diff changeset
78 package EF renames Ada.Numerics.Elementary_Functions;
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 The_Result : Float;
kono
parents:
diff changeset
81 New_Float_Result : New_Float;
kono
parents:
diff changeset
82
kono
parents:
diff changeset
83 procedure Dont_Optimize_Float is new Dont_Optimize(Float);
kono
parents:
diff changeset
84 procedure Dont_Optimize_New_Float is new Dont_Optimize(New_Float);
kono
parents:
diff changeset
85
kono
parents:
diff changeset
86 begin
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 -- Testing of Tan Function, both instantiated and pre-instantiated
kono
parents:
diff changeset
89 -- version.
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 -- Check that no exception occurs on computing the Tan with very
kono
parents:
diff changeset
92 -- large (positive and negative) input values.
kono
parents:
diff changeset
93
kono
parents:
diff changeset
94 begin
kono
parents:
diff changeset
95 New_Float_Result := GEF.Tan (New_Float(FXA5A00.Large));
kono
parents:
diff changeset
96 Dont_Optimize_New_Float(New_Float_Result, 1);
kono
parents:
diff changeset
97 exception
kono
parents:
diff changeset
98 when others =>
kono
parents:
diff changeset
99 Report.Failed("Unexpected exception on GEF.Tan with large " &
kono
parents:
diff changeset
100 "positive value");
kono
parents:
diff changeset
101 end;
kono
parents:
diff changeset
102
kono
parents:
diff changeset
103 begin
kono
parents:
diff changeset
104 The_Result := EF.Tan (FXA5A00.Minus_Large);
kono
parents:
diff changeset
105 Dont_Optimize_Float(The_Result, 2);
kono
parents:
diff changeset
106 exception
kono
parents:
diff changeset
107 when others =>
kono
parents:
diff changeset
108 Report.Failed("Unexpected exception on EF.Tan with large " &
kono
parents:
diff changeset
109 "negative value");
kono
parents:
diff changeset
110 end;
kono
parents:
diff changeset
111
kono
parents:
diff changeset
112
kono
parents:
diff changeset
113 -- Check that no exception occurs on computing the Tan with very
kono
parents:
diff changeset
114 -- small (positive and negative) input values.
kono
parents:
diff changeset
115
kono
parents:
diff changeset
116 begin
kono
parents:
diff changeset
117 New_Float_Result := GEF.Tan (New_Float(FXA5A00.Small));
kono
parents:
diff changeset
118 Dont_Optimize_New_Float(New_Float_Result, 3);
kono
parents:
diff changeset
119 exception
kono
parents:
diff changeset
120 when others =>
kono
parents:
diff changeset
121 Report.Failed("Unexpected exception on GEF.Tan with small " &
kono
parents:
diff changeset
122 "positive value");
kono
parents:
diff changeset
123 end;
kono
parents:
diff changeset
124
kono
parents:
diff changeset
125 begin
kono
parents:
diff changeset
126 The_Result := EF.Tan (-FXA5A00.Small);
kono
parents:
diff changeset
127 Dont_Optimize_Float(The_Result, 4);
kono
parents:
diff changeset
128 exception
kono
parents:
diff changeset
129 when others =>
kono
parents:
diff changeset
130 Report.Failed("Unexpected exception on EF.Tan with small " &
kono
parents:
diff changeset
131 "negative value");
kono
parents:
diff changeset
132 end;
kono
parents:
diff changeset
133
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135 -- Check prescribed result from Tan function. When the parameter X
kono
parents:
diff changeset
136 -- has the value zero, the Tan function yields a result of zero.
kono
parents:
diff changeset
137
kono
parents:
diff changeset
138 if GEF.Tan(0.0) /= 0.0 or
kono
parents:
diff changeset
139 EF.Tan(0.0) /= 0.0
kono
parents:
diff changeset
140 then
kono
parents:
diff changeset
141 Report.Failed("Incorrect result from Tan function with zero " &
kono
parents:
diff changeset
142 "value input parameter");
kono
parents:
diff changeset
143 end if;
kono
parents:
diff changeset
144
kono
parents:
diff changeset
145
kono
parents:
diff changeset
146 -- Check the results of the Tan function with various input parameters.
kono
parents:
diff changeset
147
kono
parents:
diff changeset
148 if not (Result_Within_Range(GEF.Tan(0.7854), 1.0, 0.001) and
kono
parents:
diff changeset
149 Result_Within_Range(GEF.Tan(0.8436), 1.124, 0.001) and
kono
parents:
diff changeset
150 Result_Within_Range( EF.Tan(Pi), 0.0, 0.001) and
kono
parents:
diff changeset
151 Result_Within_Range( EF.Tan(-Pi), 0.0, 0.001) and
kono
parents:
diff changeset
152 Result_Within_Range(GEF.Tan(0.5381), 0.597, 0.001) and
kono
parents:
diff changeset
153 Result_Within_Range( EF.Tan(0.1978), 0.200, 0.001))
kono
parents:
diff changeset
154 then
kono
parents:
diff changeset
155 Report.Failed("Incorrect result from Tan function with various " &
kono
parents:
diff changeset
156 "input parameters");
kono
parents:
diff changeset
157 end if;
kono
parents:
diff changeset
158
kono
parents:
diff changeset
159
kono
parents:
diff changeset
160 -- Testing of Tan function with cycle parameter.
kono
parents:
diff changeset
161
kono
parents:
diff changeset
162 -- Check that Constraint_Error is raised by the Tan function with
kono
parents:
diff changeset
163 -- specified cycle, when the value of the parameter X is an odd
kono
parents:
diff changeset
164 -- multiple of the quarter cycle.
kono
parents:
diff changeset
165
kono
parents:
diff changeset
166 if New_Float'Machine_Overflows = True then
kono
parents:
diff changeset
167 begin
kono
parents:
diff changeset
168 New_Float_Result := GEF.Tan(270.0, 360.0);
kono
parents:
diff changeset
169 Report.Failed("Constraint_Error not raised by GEF.Tan on odd " &
kono
parents:
diff changeset
170 "multiple of the quarter cycle");
kono
parents:
diff changeset
171 Dont_Optimize_New_Float(New_Float_Result, 5);
kono
parents:
diff changeset
172 exception
kono
parents:
diff changeset
173 when Constraint_Error => null; -- OK, expected exception.
kono
parents:
diff changeset
174 when others =>
kono
parents:
diff changeset
175 Report.Failed("Unexpected exception raised by GEF.Tan on odd " &
kono
parents:
diff changeset
176 "multiple of the quarter cycle");
kono
parents:
diff changeset
177 end;
kono
parents:
diff changeset
178 end if;
kono
parents:
diff changeset
179
kono
parents:
diff changeset
180 -- Check that the exception Numerics.Argument_Error is raised, when
kono
parents:
diff changeset
181 -- the value of the parameter Cycle is zero or negative.
kono
parents:
diff changeset
182
kono
parents:
diff changeset
183 begin
kono
parents:
diff changeset
184 New_Float_Result := GEF.Tan(X => 1.0, Cycle => -360.0);
kono
parents:
diff changeset
185 Report.Failed("Argument_Error not raised by GEF.Tan when Cycle " &
kono
parents:
diff changeset
186 "parameter has negative value");
kono
parents:
diff changeset
187 Dont_Optimize_New_Float(New_Float_Result, 6);
kono
parents:
diff changeset
188 exception
kono
parents:
diff changeset
189 when Argument_Error => null; -- OK, expected exception.
kono
parents:
diff changeset
190 when others =>
kono
parents:
diff changeset
191 Report.Failed("Unexpected exception raised by GEF.Tan when Cycle " &
kono
parents:
diff changeset
192 "parameter has negative value");
kono
parents:
diff changeset
193 end;
kono
parents:
diff changeset
194
kono
parents:
diff changeset
195 begin
kono
parents:
diff changeset
196 The_Result := EF.Tan(1.0, Cycle => 0.0);
kono
parents:
diff changeset
197 Report.Failed("Argument_Error not raised by GEF.Tan when Cycle " &
kono
parents:
diff changeset
198 "parameter has a zero value");
kono
parents:
diff changeset
199 Dont_Optimize_Float(The_Result, 7);
kono
parents:
diff changeset
200 exception
kono
parents:
diff changeset
201 when Argument_Error => null; -- OK, expected exception.
kono
parents:
diff changeset
202 when others =>
kono
parents:
diff changeset
203 Report.Failed("Unexpected exception raised by EF.Tan when Cycle " &
kono
parents:
diff changeset
204 "parameter has a zero value");
kono
parents:
diff changeset
205 end;
kono
parents:
diff changeset
206
kono
parents:
diff changeset
207
kono
parents:
diff changeset
208 -- Check that no exception occurs on computing the Tan with very
kono
parents:
diff changeset
209 -- large (positive and negative) input values.
kono
parents:
diff changeset
210
kono
parents:
diff changeset
211 begin
kono
parents:
diff changeset
212 New_Float_Result := GEF.Tan (New_Float(FXA5A00.Large), 360.0);
kono
parents:
diff changeset
213 Dont_Optimize_New_Float(New_Float_Result, 8);
kono
parents:
diff changeset
214 exception
kono
parents:
diff changeset
215 when others =>
kono
parents:
diff changeset
216 Report.Failed("Unexpected exception on GEF.Tan with large " &
kono
parents:
diff changeset
217 "positive value");
kono
parents:
diff changeset
218 end;
kono
parents:
diff changeset
219
kono
parents:
diff changeset
220 begin
kono
parents:
diff changeset
221 The_Result := EF.Tan (FXA5A00.Minus_Large, Cycle => 360.0);
kono
parents:
diff changeset
222 Dont_Optimize_Float(The_Result, 9);
kono
parents:
diff changeset
223 exception
kono
parents:
diff changeset
224 when others =>
kono
parents:
diff changeset
225 Report.Failed("Unexpected exception on EF.Tan with large " &
kono
parents:
diff changeset
226 "negative value");
kono
parents:
diff changeset
227 end;
kono
parents:
diff changeset
228
kono
parents:
diff changeset
229
kono
parents:
diff changeset
230 -- Check prescribed result from Tan function with Cycle parameter.
kono
parents:
diff changeset
231
kono
parents:
diff changeset
232 if GEF.Tan(0.0, 360.0) /= 0.0 or
kono
parents:
diff changeset
233 EF.Tan(0.0, Cycle => 360.0) /= 0.0
kono
parents:
diff changeset
234 then
kono
parents:
diff changeset
235 Report.Failed("Incorrect result from Tan function with cycle " &
kono
parents:
diff changeset
236 "parameter, using a zero value input parameter");
kono
parents:
diff changeset
237 end if;
kono
parents:
diff changeset
238
kono
parents:
diff changeset
239
kono
parents:
diff changeset
240 -- Check the Tan function, with specified Cycle parameter, with a
kono
parents:
diff changeset
241 -- variety of input parameters.
kono
parents:
diff changeset
242
kono
parents:
diff changeset
243 if not Result_Within_Range(GEF.Tan(30.0, 360.0), 0.577, 0.001) or
kono
parents:
diff changeset
244 not Result_Within_Range( EF.Tan(57.0, 360.0), 1.540, 0.001) or
kono
parents:
diff changeset
245 not Result_Within_Range(GEF.Tan(115.0, 360.0), -2.145, 0.001) or
kono
parents:
diff changeset
246 not Result_Within_Range( EF.Tan(299.0, 360.0), -1.804, 0.001) or
kono
parents:
diff changeset
247 not Result_Within_Range(GEF.Tan(390.0, 360.0), 0.577, 0.001) or
kono
parents:
diff changeset
248 not Result_Within_Range( EF.Tan(520.0, 360.0), -0.364, 0.001)
kono
parents:
diff changeset
249 then
kono
parents:
diff changeset
250 Report.Failed("Incorrect result from the Tan function with " &
kono
parents:
diff changeset
251 "cycle parameter, with various input parameter " &
kono
parents:
diff changeset
252 "values");
kono
parents:
diff changeset
253 end if;
kono
parents:
diff changeset
254
kono
parents:
diff changeset
255
kono
parents:
diff changeset
256
kono
parents:
diff changeset
257 -- Testing of Tanh Function, both instantiated and pre-instantiated
kono
parents:
diff changeset
258 -- version.
kono
parents:
diff changeset
259
kono
parents:
diff changeset
260 -- Check that no exception occurs on computing the Tan with very
kono
parents:
diff changeset
261 -- large (positive and negative) input values.
kono
parents:
diff changeset
262
kono
parents:
diff changeset
263 begin
kono
parents:
diff changeset
264 New_Float_Result := GEF.Tanh (New_Float(FXA5A00.Large));
kono
parents:
diff changeset
265 Dont_Optimize_New_Float(New_Float_Result, 10);
kono
parents:
diff changeset
266 exception
kono
parents:
diff changeset
267 when others =>
kono
parents:
diff changeset
268 Report.Failed("Unexpected exception on GEF.Tanh with large " &
kono
parents:
diff changeset
269 "positive value");
kono
parents:
diff changeset
270 end;
kono
parents:
diff changeset
271
kono
parents:
diff changeset
272 begin
kono
parents:
diff changeset
273 The_Result := EF.Tanh (FXA5A00.Minus_Large);
kono
parents:
diff changeset
274 Dont_Optimize_Float(The_Result, 11);
kono
parents:
diff changeset
275 exception
kono
parents:
diff changeset
276 when others =>
kono
parents:
diff changeset
277 Report.Failed("Unexpected exception on EF.Tanh with large " &
kono
parents:
diff changeset
278 "negative value");
kono
parents:
diff changeset
279 end;
kono
parents:
diff changeset
280
kono
parents:
diff changeset
281
kono
parents:
diff changeset
282 -- Check for prescribed result of Tanh with zero value input parameter.
kono
parents:
diff changeset
283
kono
parents:
diff changeset
284 if GEF.Tanh (0.0) /= 0.0 or
kono
parents:
diff changeset
285 EF.Tanh (0.0) /= 0.0
kono
parents:
diff changeset
286 then
kono
parents:
diff changeset
287 Report.Failed("Incorrect result from Tanh with zero parameter");
kono
parents:
diff changeset
288 end if;
kono
parents:
diff changeset
289
kono
parents:
diff changeset
290
kono
parents:
diff changeset
291 -- Check the results of the Tanh function with various input
kono
parents:
diff changeset
292 -- parameters.
kono
parents:
diff changeset
293
kono
parents:
diff changeset
294 if not (FXA5A00.Result_Within_Range(GEF.Tanh(2.99), 0.995, 0.001) and
kono
parents:
diff changeset
295 FXA5A00.Result_Within_Range(GEF.Tanh(0.130), 0.129, 0.001) and
kono
parents:
diff changeset
296 FXA5A00.Result_Within_Range( EF.Tanh(Pi), 0.996, 0.001) and
kono
parents:
diff changeset
297 FXA5A00.Result_Within_Range( EF.Tanh(-Pi), -0.996, 0.001) and
kono
parents:
diff changeset
298 FXA5A00.Result_Within_Range(GEF.Tanh(0.60), 0.537, 0.001) and
kono
parents:
diff changeset
299 FXA5A00.Result_Within_Range( EF.Tanh(1.04), 0.778, 0.001) and
kono
parents:
diff changeset
300 FXA5A00.Result_Within_Range(GEF.Tanh(1.55), 0.914, 0.001) and
kono
parents:
diff changeset
301 FXA5A00.Result_Within_Range( EF.Tanh(-2.14), -0.973, 0.001))
kono
parents:
diff changeset
302 then
kono
parents:
diff changeset
303 Report.Failed("Incorrect result from Tanh function with various " &
kono
parents:
diff changeset
304 "input parameters");
kono
parents:
diff changeset
305 end if;
kono
parents:
diff changeset
306
kono
parents:
diff changeset
307
kono
parents:
diff changeset
308
kono
parents:
diff changeset
309 -- Testing of Arctanh Function, both instantiated and pre-instantiated
kono
parents:
diff changeset
310 -- version.
kono
parents:
diff changeset
311
kono
parents:
diff changeset
312 -- Check that Constraint_Error is raised by the Arctanh function
kono
parents:
diff changeset
313 -- when the absolute value of the parameter X is one.
kono
parents:
diff changeset
314
kono
parents:
diff changeset
315 if New_Float'Machine_Overflows = True then
kono
parents:
diff changeset
316 begin
kono
parents:
diff changeset
317 New_Float_Result := GEF.Arctanh(X => 1.0);
kono
parents:
diff changeset
318 Report.Failed("Constraint_Error not raised by Function Arctanh " &
kono
parents:
diff changeset
319 "when provided a parameter value of 1.0");
kono
parents:
diff changeset
320 Dont_Optimize_New_Float(New_Float_Result, 12);
kono
parents:
diff changeset
321 exception
kono
parents:
diff changeset
322 when Constraint_Error => null; -- OK, expected exception.
kono
parents:
diff changeset
323 when others =>
kono
parents:
diff changeset
324 Report.Failed("Unexpected exception raised by Function Arctanh "
kono
parents:
diff changeset
325 & "when provided a parameter value of 1.0");
kono
parents:
diff changeset
326 end;
kono
parents:
diff changeset
327 end if;
kono
parents:
diff changeset
328
kono
parents:
diff changeset
329 if Float'Machine_Overflows = True then
kono
parents:
diff changeset
330 begin
kono
parents:
diff changeset
331 The_Result := EF.Arctanh(-1.0);
kono
parents:
diff changeset
332 Report.Failed("Constraint_Error not raised by Function Arctanh " &
kono
parents:
diff changeset
333 "when provided a parameter value of -1.0");
kono
parents:
diff changeset
334 Dont_Optimize_Float(The_Result, 13);
kono
parents:
diff changeset
335 exception
kono
parents:
diff changeset
336 when Constraint_Error => null; -- OK, expected exception.
kono
parents:
diff changeset
337 when others =>
kono
parents:
diff changeset
338 Report.Failed("Unexpected exception raised by Function Arctanh "
kono
parents:
diff changeset
339 & "when provided a parameter value of -1.0");
kono
parents:
diff changeset
340 end;
kono
parents:
diff changeset
341 end if;
kono
parents:
diff changeset
342
kono
parents:
diff changeset
343 -- Check that Function Arctanh raises Argument_Error when the absolute
kono
parents:
diff changeset
344 -- value of the parameter X exceeds one.
kono
parents:
diff changeset
345
kono
parents:
diff changeset
346 begin
kono
parents:
diff changeset
347 New_Float_Result := GEF.Arctanh(New_Float(FXA5A00.One_Plus_Delta));
kono
parents:
diff changeset
348 Report.Failed("Argument_Error not raised by Function Arctanh " &
kono
parents:
diff changeset
349 "when provided a parameter value greater than 1.0");
kono
parents:
diff changeset
350 Dont_Optimize_New_Float(New_Float_Result, 14);
kono
parents:
diff changeset
351 exception
kono
parents:
diff changeset
352 when Argument_Error => null; -- OK, expected exception.
kono
parents:
diff changeset
353 when others =>
kono
parents:
diff changeset
354 Report.Failed("Unexpected exception raised by Function Arctanh " &
kono
parents:
diff changeset
355 "when provided a parameter value greater than 1.0");
kono
parents:
diff changeset
356 end;
kono
parents:
diff changeset
357
kono
parents:
diff changeset
358
kono
parents:
diff changeset
359 begin
kono
parents:
diff changeset
360 The_Result := EF.Arctanh(FXA5A00.Minus_One_Minus_Delta);
kono
parents:
diff changeset
361 Report.Failed("Argument_Error not raised by Function Arctanh " &
kono
parents:
diff changeset
362 "when provided a parameter value less than -1.0");
kono
parents:
diff changeset
363 Dont_Optimize_Float(The_Result, 15);
kono
parents:
diff changeset
364 exception
kono
parents:
diff changeset
365 when Argument_Error => null; -- OK, expected exception.
kono
parents:
diff changeset
366 when others =>
kono
parents:
diff changeset
367 Report.Failed("Unexpected exception raised by Function Arctanh " &
kono
parents:
diff changeset
368 "when provided a parameter value less than -1.0");
kono
parents:
diff changeset
369 end;
kono
parents:
diff changeset
370
kono
parents:
diff changeset
371
kono
parents:
diff changeset
372 begin
kono
parents:
diff changeset
373 New_Float_Result := GEF.Arctanh(New_Float(FXA5A00.Large));
kono
parents:
diff changeset
374 Report.Failed("Argument_Error not raised by Function Arctanh " &
kono
parents:
diff changeset
375 "when provided a large positive parameter value");
kono
parents:
diff changeset
376 Dont_Optimize_New_Float(New_Float_Result, 16);
kono
parents:
diff changeset
377 exception
kono
parents:
diff changeset
378 when Argument_Error => null; -- OK, expected exception.
kono
parents:
diff changeset
379 when others =>
kono
parents:
diff changeset
380 Report.Failed("Unexpected exception raised by Function Arctanh " &
kono
parents:
diff changeset
381 "when provided a large positive parameter value");
kono
parents:
diff changeset
382 end;
kono
parents:
diff changeset
383
kono
parents:
diff changeset
384
kono
parents:
diff changeset
385 begin
kono
parents:
diff changeset
386 The_Result := EF.Arctanh(FXA5A00.Minus_Large);
kono
parents:
diff changeset
387 Report.Failed("Argument_Error not raised by Function Arctanh " &
kono
parents:
diff changeset
388 "when provided a large negative parameter value");
kono
parents:
diff changeset
389 Dont_Optimize_Float(The_Result, 17);
kono
parents:
diff changeset
390 exception
kono
parents:
diff changeset
391 when Argument_Error => null; -- OK, expected exception.
kono
parents:
diff changeset
392 when others =>
kono
parents:
diff changeset
393 Report.Failed("Unexpected exception raised by Function Arctanh " &
kono
parents:
diff changeset
394 "when provided a large negative parameter value");
kono
parents:
diff changeset
395 end;
kono
parents:
diff changeset
396
kono
parents:
diff changeset
397
kono
parents:
diff changeset
398 -- Prescribed results for Function Arctanh with zero input value.
kono
parents:
diff changeset
399
kono
parents:
diff changeset
400 if GEF.Arctanh(0.0) /= 0.0 or
kono
parents:
diff changeset
401 EF.Arctanh(0.0) /= 0.0
kono
parents:
diff changeset
402 then
kono
parents:
diff changeset
403 Report.Failed("Incorrect result from Function Arctanh with a " &
kono
parents:
diff changeset
404 "parameter value of zero");
kono
parents:
diff changeset
405 end if;
kono
parents:
diff changeset
406
kono
parents:
diff changeset
407
kono
parents:
diff changeset
408 -- Check the results of the Arctanh function with various input
kono
parents:
diff changeset
409 -- parameters.
kono
parents:
diff changeset
410
kono
parents:
diff changeset
411 if not (Result_Within_Range(GEF.Arctanh(0.15), 0.151, 0.001) and
kono
parents:
diff changeset
412 Result_Within_Range( EF.Arctanh(0.44), 0.472, 0.001) and
kono
parents:
diff changeset
413 Result_Within_Range(GEF.Arctanh(0.81), 1.127, 0.001) and
kono
parents:
diff changeset
414 Result_Within_Range( EF.Arctanh(0.99), 2.647, 0.001))
kono
parents:
diff changeset
415 then
kono
parents:
diff changeset
416 Report.Failed("Incorrect result from Arctanh function with " &
kono
parents:
diff changeset
417 "various input parameters");
kono
parents:
diff changeset
418 end if;
kono
parents:
diff changeset
419
kono
parents:
diff changeset
420 exception
kono
parents:
diff changeset
421 when others => Report.Failed ("Exception raised in Test_Block");
kono
parents:
diff changeset
422 end Test_Block;
kono
parents:
diff changeset
423
kono
parents:
diff changeset
424 Report.Result;
kono
parents:
diff changeset
425
kono
parents:
diff changeset
426 end CXA5A03;