2 # Copyright 2013 Advanced Micro Devices, Inc.
4 # Permission is hereby granted, free of charge, to any person obtaining a
5 # copy of this software and associated documentation files (the "Software"),
6 # to deal in the Software without restriction, including without limitation
7 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 # and/or sell copies of the Software, and to permit persons to whom the
9 # Software is furnished to do so, subject to the following conditions:
11 # The above copyright notice and this permission notice (including the next
12 # paragraph) shall be included in all copies or substantial portions of the
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 # Authors: Tom Stellard <thomas.stellard@amd.com>
24 # Aaron Watry <awatry@gmail.com>
27 from __future__
import print_function
, division
, absolute_import
30 from genclbuiltins
import gen
, NEGNAN
31 from math
import acos
, acosh
, asin
, asinh
, atan
, atan2
, atanh
, cos
, cosh
, exp
, expm1
32 from math
import fabs
, fmod
, gamma
, hypot
, lgamma
, log
, log10
, log1p
, modf
, pi
, pow, sin
, sinh
, sqrt
, tan
, tanh
104 DATA_TYPES
= ['float']
118 M_PI_F
= float.fromhex('0x1.921fb6p+1')
121 return int(round(x
/y
))
125 'arg_types' : [F
, F
],
126 'function_type': 'ttt',
128 [ pi
, pi
/2, 0.0, acos(0.12345), float("nan")], # Result
129 [-1.0, 0.0, 1.0, 0.12345, float("nan")] # Arg0
134 'arg_types' : [F
, F
],
135 'function_type': 'ttt',
137 [0.0, acosh(1.12345), float("nan"), acosh(123456789.01234)], #Result
138 [1.0, 1.12345, float("nan"), 123456789.01234 ] #Arg0
143 'arg_types' : [F
, F
],
144 'function_type': 'ttt',
146 [ 1, 1/2, 0.0, acos(0.12345) / pi
, float("nan")], # Result
147 [-1.0, 0.0, 1.0, 0.12345, float("nan")] # Arg0
152 'arg_types' : [F
, F
],
153 'function_type': 'ttt',
155 [-pi
/2, 0.0, pi
/2, asin(0.12345), float("nan")], # Result
156 [-1.0, 0.0, 1.0, 0.12345, float("nan")] # Arg0
161 'arg_types' : [F
, F
],
162 'function_type': 'ttt',
164 [0.0, asinh(1.0), asinh(-1.12345), float("nan"), asinh(123456789.01234)], #Result
165 [0.0, 1.0, -1.12345, float("nan"), 123456789.01234 ] #Arg0
170 'arg_types' : [F
, F
],
171 'function_type': 'ttt',
173 [-1/2, 0.0, 1/2, asin(0.12345)/pi
, float("nan")], # Result
174 [-1.0, 0.0, 1.0, 0.12345, float("nan")] # Arg0
179 'arg_types' : [F
, F
],
180 'function_type': 'ttt',
182 [atan(0.0), atan(0.12345), atan(3567147.0)], # Result
183 [0.0, 0.12345, 3567147.0]# Arg0
188 'arg_types' : [F
, F
, F
],
189 'function_type': 'ttt',
191 [atan2(0.0, 0.0), atan2(1.2345, 10.0), atan2(35671470.0, 0.1)], # Result
192 [0.0, 1.2345, 35671470.0 ], # Arg0
193 [0.0, 10.0, 0.1 ] # Arg1
198 'arg_types' : [F
, F
, F
],
199 'function_type': 'ttt',
201 [atan2(0.0, 0.0)/pi
, atan2(1.2345, 10.0)/pi
, atan2(35671470.0, 0.1)/pi
], # Result
202 [0.0, 1.2345, 35671470.0 ], # Arg0
203 [0.0, 10.0, 0.1 ] # Arg1
208 'arg_types' : [F
, F
],
209 'function_type': 'ttt',
211 [0.0, float("inf"), float("-inf"), float("nan"), atanh(0.123456789)], #Result
212 [0.0, 1.0, -1.0, float("nan"), 0.123456789 ] #Arg0
217 'arg_types' : [F
, F
],
218 'function_type': 'ttt',
220 [0.0, -0.0, atan(1.02345)/pi
, atan(-1.02345)/pi
, float("nan"), 0.5, -0.5 ],
221 [0.0, -0.0, 1.02345, -1.02345, float("nan"), float("inf"), float("-inf") ]
227 'function_type': 'ttt',
229 [3.0, -1.0, float("nan"), float("inf"), 0.123456789**(1/3.0) ],
230 [27.0, -1.0, float("nan"), float("inf"), 0.123456789 ]
236 'function_type': 'ttt',
238 [1.0, 0.0, 0.0, -0.0, float("nan"), -3.0],
239 [0.5, -0.5, 0.0, -0.0, float("nan"), -3.99]
243 'arg_types': [F
, F
, F
],
244 'function_type': 'ttt',
246 [0.0, -0.0, 1.0, -1.0, float("nan"), float("nan"), NEGNAN
, float("-inf"), float("inf") ], # Result
247 [0.0, 0.0, 1.0, -1.0, float("nan"), -4.0, float("nan"), float("inf"), float("-inf") ], # Arg0
248 [1.0, -1.0, 2.0, -2.0, float("nan"), float("nan"), -4.0, -3.0, float("inf") ], # Arg1
252 'arg_types' : [F
, F
],
253 'function_type': 'ttt',
255 # using libm cosf(3.0f * M_PI / 2.0f) == 0x1.99bc5cp-27
256 # this is different form what python gives us
257 [1.0, cos(M_PI_F
/ 2), -1.0, float.fromhex('0x1.99bc5cp-27'), 1.0, cos(1.12345), cos(7), cos(8), cos(pow(2,20)), cos(pow(2,24)), cos(pow(2,120)), float("nan")], # Result
258 [0.0, M_PI_F
/ 2, pi
, 3 * M_PI_F
/ 2, 2 * pi
, 1.12345, 7, 8, pow(2,20), pow(2,24), pow(2,120), float("nan")] # Arg0
263 'arg_types' : [F
, F
],
264 'function_type': 'ttt',
266 [1.0, cosh(0.123456789), float("inf"), float("inf"), float("nan")],# Result
267 [0.0, 0.123456789, float("inf"), float("-inf"), float("nan")] # Arg0
272 'arg_types' : [F
, F
],
273 'function_type': 'ttt',
275 [1.0, cos(pi
* M_PI_F
/ 2), cos(pi
*3*pi
/2), cos(2 * M_PI_F
* pi
), cos(pi
*1.12345), cos(pi
*pow(2,20)), cos(pi
*pow(2,24)), 1.0, float("nan")], # Result
276 [0.0, pi
/ 2, 3 * pi
/ 2, 2 * pi
, 1.12345 , pow(2,20), pow(2,24), pow(2,120), float("nan")] # Arg0
281 'arg_types' : [F
, F
],
282 'function_type': 'ttt',
284 [0.0, 0.950004, 0.990005, -0.994999475, 1.0, 1, -1], # Result
285 [0.0, 1.960/sqrt(2.0), 2.576/sqrt(2.0), -2.807/sqrt(2.0), 11.1, float("inf"), float("-inf")] # Arg0
290 'arg_types' : [F
, F
],
291 'function_type': 'ttt',
293 [1.0, float.fromhex('0x1.9990c6p-5'), float.fromhex('0x1.4784aep-7'), 1.994999, 0.0, 0.0, 2.0], # Result
294 [0.0, 1.960/sqrt(2.0), 2.576/sqrt(2.0), -2.807/sqrt(2.0), 11.1, float("inf"), float("-inf")] # Arg0
299 'arg_types' : [F
, F
],
300 'function_type': 'ttt',
302 [1.0, exp(0.95), exp(pi
), exp(-pi
), float("inf"), float.fromhex('0x1.66fe8ap+4')], # Result
303 [0.0, 0.95, pi
, -pi
, float("inf"), float.fromhex('0x1.8e2cp+1')] # Arg0
308 'arg_types' : [F
, F
],
309 'function_type': 'ttt',
311 [1.0, 10 ** 0.95, 10 ** pi
, 10 ** -pi
, float("inf"), float.fromhex('0x1.4298593c335e3p+10')], # Result
312 [0.0, 0.95, pi
, -pi
, float("inf"), float.fromhex('0x1.8e2cp+1')] # Arg0
317 'arg_types' : [F
, F
],
318 'function_type': 'ttt',
320 [1.0, 2 ** 0.95, 2 ** pi
, 2 ** -pi
, float("inf"), float.fromhex('0x1.146b7fd8431e3p+3')], # Result
321 [0.0, 0.95, pi
, -pi
, float("inf"), float.fromhex('0x1.8e2cp+1')] # Arg0
326 'arg_types' : [F
, F
],
327 'function_type': 'ttt',
329 [0.0, expm1(0.95), expm1(pi
), expm1(-pi
), float("inf"), float.fromhex('0x1.56fe8a160893ep+4')], # Result
330 [0.0, 0.95, pi
, -pi
, float("inf"), float.fromhex('0x1.8e2cp+1')] # Arg0
335 'arg_types' : [F
, F
],
336 'function_type': 'ttt',
338 [0.0, pi
/2, pi
, 0.0, float("inf"), float("inf"), 1.12345 ], # Result
339 [0.0, -pi
/2, pi
, -0.0, float("-inf"), float("inf"), -1.12345] # Arg0
344 'arg_types' : [F
, F
, F
],
345 'function_type': 'ttt',
347 [0.0, 0.75, 0.0, 0.0, float("inf"), 0.0, float("nan"), float("nan"), float("nan"), 2.2469 ], # Result
348 [0.3, 1.0, pi
, 0.0, float("inf"), float("inf"), float("nan"), 1.0, float("nan"), 1.12345 ], # Arg0
349 [1.5, 0.25, pi
, -0.0, float("-inf"), float("inf"), float("nan"), float("nan"), 1.0, -1.12345] # Arg1
354 'function_type': 'ttt',
356 [0.0, -1.0, 0.0, -0.0, float("nan"), -4.0, 1.0],
357 [0.5, -0.5, 0.0, -0.0, float("nan"), -3.99, 1.5]
361 'arg_types': [F
, F
, F
, F
],
362 'function_type': 'tss',
364 [pi
, 1.0, pi
, -0.5, float("nan"), float("nan"), float("nan")], # Result
365 [1.0, pi
, 0.0, 0.0, 1.0, float("nan"), float("nan")], # Arg0
366 [pi
, 0.0, pi
, -0.5, float("nan"), 1.0, float("nan")], # Arg1
367 [0.0, 1.0, pi
, -0.5, float("nan"), 1.0, float("nan")] # Arg2
371 'arg_types': [F
, F
, F
],
372 'function_type': 'tss',
374 [1.0, 0.0, 0.0, 0.0, 1.0, 1.0, float("nan")], #Result
375 [1.0, -0.5, 0.0, 0.0, 1.0, float("nan"), float("nan")], #Arg0
376 [0.0, 0.0, 0.0, -0.5, float("nan"), 1.0, float("nan")] #Arg1
380 'arg_types': [F
, F
, F
],
381 'function_type': 'tss',
383 [0.0, -0.5, 0.0, -0.5, 1.0, 1.0, float("nan")], #Result
384 [1.0, -0.5, 0.0, 0.0, 1.0, float("nan"), float("nan")], #Arg0
385 [0.0, 0.0, 0.0, -0.5, float("nan"), 1.0, float("nan")] #Arg1
389 'arg_types': [F
, F
, F
],
390 'function_type': 'ttt',
392 [float.fromhex("0x1.99998p-4"), float("nan"), float.fromhex("-0x1.47aep-7"), 1.0, float("-nan"), float("nan")],
393 [float.fromhex("0x1.466666p+2"), 0.0, float.fromhex("-0x1p+2"), 1.0, 5.1, 3.0 ],
394 [float.fromhex("0x1p-1"), float("nan"), float.fromhex("-0x1.feb852p+1"), 1.5, 0.0, float("inf")]
399 'arg_types': [F
, F
, F
],
400 'function_type': 'ttt',
401 # For fract we have two outputs per address space.
403 [float("nan"), 0.0, 0.5, 0.0, float.fromhex('0x1.33333p-2'), float.fromhex('0x1.fffffep-1') ], #fract
404 [float("nan"), float("inf"), 1.0, 2.0, -2.0, -1.0], #floor
405 [float("nan"), float("inf"), 1.5, 2.0,float.fromhex('-0x1.b33334p+0'), float.fromhex('-0x1.000242p-24')] #src0
410 'arg_types': [F
, I
, F
],
411 'function_type': 'ttt',
412 # For frexp we have two outputs per address space.
414 [0.602783203125, 0.5, float("nan"), float("nan"), float("inf"), float("-inf"), 0.0],
415 [11, 1, 0, 0, 0, 0, 0],
416 [1234.5, 1.0, float("nan"), float("-nan"), float("inf"), float("-inf"), 0.0]
421 'arg_types': [F
, F
, F
],
422 'function_type': 'ttt',
424 [hypot(0, 1.0), hypot(3, 10.0), hypot(1, -3.0), hypot(10, 1234.5), hypot(2147483647, -1.0), float("inf")], # Result
425 [0, 3, 1, 10, 2147483647, 2147483647], # Arg0
426 [1.0, 10.0, -3.0, 1234.5, -1.0, float("-inf")] # Arg1
432 'function_type': 'ttt',
434 [0, 3, 1, 10, 2147483647, 2147483647],
435 [1.0, 10.0, -3.0, 1234.5, float("inf"), float("-inf")]
440 'arg_types': [F
, F
, I
],
441 'function_type': 'tss',
443 [0.0, 4.0, 15.2, 1.75, float("nan"), float("inf")],
444 [0.0, 1.0, 0.95, 3.5, float("nan"), 1.12312312],
445 [0, 2, 4, -1, 1, 2031231231]
451 'function_type': 'ttt',
453 [0.0, lgamma(1.5), lgamma(0.5), float("nan"), lgamma(1.e
-15), float("nan")], # Result
454 [1.0, 1.5, 0.5, 0.0, 1.e
-15, float("nan")] # Arg
456 'tolerance' : 16777216 # Specs say it's currently undefined
459 'arg_types': [F
, I
, F
],
460 'function_type': 'ttt',
462 [0.0, lgamma(1.5), lgamma(0.5), float("nan"), lgamma(1.e
-15), float("nan")], # Result0
463 [1, -1, 1, 1, 1, 1], # Result1
464 [1.0, 1.5, 0.5, 0.0, 1.e
-15, float("nan")] # Arg
466 'tolerance' : 16777216, # Specs say it's currently undefined
471 'function_type': 'ttt',
473 [log(0.5), float("-inf"), log(1.e
-15), float("nan")], #Result
474 [0.5, 0.0, 1.e
-15, float("nan")] #Arg0
480 'function_type': 'ttt',
482 [log10(0.5), float("-inf"), log10(1.e
-15), float("nan")],
483 [0.5, 0.0, 1.e
-15, float("nan")]
489 'function_type': 'ttt',
491 [log1p(0.5), float("-inf"), log1p(1.e
-15), float("nan")],
492 [0.5, -1.0, 1.e
-15, float("nan")]
498 'function_type': 'ttt',
500 [log(0.5, 2), float("-inf"), log(1.e
-15, 2), float("nan")], #Result
501 [0.5, 0.0, 1.e
-15, float("nan")] #Arg0
507 'function_type': 'ttt',
509 [0, 3, 1, 10, float("inf"), float("inf")], #Result
510 [1.0, 10.0, -3.0, 1234.5, float("inf"), float("-inf")] #Arg0
515 'arg_types': [F
, F
, F
, F
],
516 'function_type': 'tss',
518 [pi
, 1.0, pi
, -0.5, float("nan"), float("nan"), float("nan")], # Result
519 [1.0, pi
, 0.0, 0.0, 1.0, float("nan"), float("nan")], # Arg0
520 [pi
, 0.0, pi
, -0.5, float("nan"), 1.0, float("nan")], # Arg1
521 [0.0, 1.0, pi
, -0.5, float("nan"), 1.0, float("nan")] # Arg2
523 'tolerance' : 16777216 #infinite ULP
526 'arg_types': [F
, F
, F
],
527 'function_type': 'ttt',
529 [1.0, -0.5, 0.0, -0.5, 1.0, 1.0, float("nan")], #Result
530 [1.0, -0.5, 0.0, 0.0, 1.0, float("nan"), float("nan")], #Arg0
531 [0.0, 0.0, 0.0, -0.5, float("nan"), 1.0, float("nan")] #Arg1
535 'arg_types': [F
, F
, F
],
536 'function_type': 'ttt',
538 [0.0, -0.5, 0.0, 1.0, 1.0, 1.0, float("nan")], #Result
539 [1.0, -0.5, 1.0, 1.0, 1.0, float("nan"), float("nan")], #Arg0
540 [0.0, 1.0, 0.0, -1.5, float("nan"), 1.0, float("nan")] #Arg1
544 'arg_types': [F
, F
, F
],
545 'function_type': 'ttt',
547 [0.0, modf(1.5)[0], modf(0.25)[0], 0.0, modf(1.e
-15)[0], float("nan")], # Result0
548 [1, modf(1.5)[1], modf(0.25)[1], 0.0, modf(1.e
-15)[1], float("nan")], # Result1
549 [1.0, 1.5, 0.25, 0.0, 1.e
-15, float("nan")] # Arg
553 # FIXME: kernel names are broken, and we cant really compare nans to see if the
556 # 'arg_types': [F, U],
557 # 'function_type': 'ttt',
559 # [float("nan"), float("nan"), float("nan")],
560 # [0xdead, 0xadbeef, 0xdead]
565 'arg_types': [F
, F
, F
],
566 'function_type': 'ttt',
568 [1.401298e-45, -1.401298e-45, 1.00000011920928955078125, 0.999999940395355224609375, float("nan"), float("nan"), 5.0 ], # Result
569 [0.0, 0.0 , 1.0, 1.0, float("nan"), 2.5, 5.0], # Arg0
570 [1.0, -1.0 , 2.0, 0.0, 3.4, float("nan"), 5.0], # Arg1
574 'arg_types': [F
, F
, F
],
575 'function_type': 'ttt',
577 [pow(0, 1.0), pow(-3, 10.0), pow(-11, -3.0), pow(1234.5, 10), pow(2147483647, -1.0), float("inf")], # Result
578 [0, -3, -11, 1234.5, 2147483647, 2147483647], # Arg0
579 [1.0, 10.0, -3.0, 10, -1.0, float("-inf")] # Arg1
584 'arg_types': [F
, F
, I
],
585 'function_type': 'ttt',
587 [pow(1, 0), pow(10.0, 3), pow(-3.3, -4), pow(1234, 10), pow(-1, 2147483647), float("-inf")], # Result
588 [1.0, 10.0, -3.3, 1234, -1.0, float("-inf")], # Arg0
589 [0, 3, -4, 10, 2147483647, 2147483647] # Arg1
594 'arg_types': [F
, F
, F
],
595 'function_type': 'ttt',
597 [pow(0, 1.0), pow(3, 10.0), pow(11, -3.0), pow(1234.5, 10), pow(2147483647, -1.0), 0.0], # Result
598 [0, 3, 11, 1234.5, 2147483647, 2147483647], # Arg0
599 [1.0, 10.0, -3.0, 10, -1.0, float("-inf")] # Arg1
604 'arg_types': [F
, F
, F
],
605 'function_type': 'ttt',
607 [float.fromhex("-0x1.ccccdp-1"), float.fromhex("0x1.ccccdp-1"),
608 float.fromhex("-0x1.ccccdp-1"), float.fromhex("0x1.ccccdp-1"),
609 0.0, -0.0, 5.1, float("-nan")
611 [ 5.1, -5.1, 5.1, -5.1, 0.0, -0.0, 5.1, 5.1], # Arg0
612 [ 3.0, 3.0, -3.0, -3.0, 1.0, 1.0, float("inf"), 0.0], # Arg1
616 'arg_types': [F
, I
, F
, F
],
617 'function_type': 'ttt',
619 [float.fromhex("-0x1.ccccdp-1"), float.fromhex("0x1.ccccdp-1"),
620 float.fromhex("-0x1.ccccdp-1"), float.fromhex("0x1.ccccdp-1"),
621 0.0, -0.0, 5.1, float("-nan")
623 [quo(5.1, 3.0), quo(-5.1, 3.0), quo(5.1, -3.0), quo(-5.1, -3.0),
624 quo(0.0, 1.0), quo(-0.0, 1.0), quo(5.1, float("inf")), 0], # Arg0
625 [ 5.1, -5.1, 5.1, -5.1, 0.0, -0.0, 5.1, 5.1], # Arg0
626 [ 3.0, 3.0, -3.0, -3.0, 1.0, 1.0, float("inf"), 0.0], # Arg1
632 'function_type': 'ttt',
634 [0.0, -0.0, 1.0, -1.0, float("nan"), -4.0, 2.0, 0.0, 1.0],
635 [0.5, -0.5, 0.6, -0.6, float("nan"), -3.99, 1.5, 0.4, 0.6]
639 'arg_types': [F
, F
, I
],
640 'function_type': 'ttt',
642 [pow(1, 1/2), pow(10.0, 1/3), float("nan"), pow(1234, 1/10), -1, float("-inf")], # Result
643 [1.0, 10.0, -3.3, 1234, -1.0, float("-inf")], # Arg0
644 [2, 3, -4, 10, 2147483647, 2147483647] # Arg1
650 'function_type': 'ttt',
652 [1.0, -1.0, 0.0, -0.0, float("nan"), -4.0, 2.0, 0.0, 1.0],
653 [0.5, -0.5, 0.0, -0.0, float("nan"), -3.99, 1.5, 0.4, 0.6]
658 'function_type': 'ttt',
660 [1.0, 1.0/2.0, 1/6.0, 1/2.5 , float("nan"), 1/4.0, float("inf"), 1/sqrt(7.0), 1/sqrt(pi
)], # Result
661 [1.0, 4.0, 36.0, 6.25, float("nan"), 16.0, 0.0, 7.0, pi
], # Arg1
666 'arg_types' : [F
, F
],
667 'function_type': 'ttt',
669 [0.0, 1.0, sin(M_PI_F
), -1.0, sin(2 * M_PI_F
), sin(2.234567), sin(7), sin(8), sin(pow(2,20)), sin(pow(2,24)), sin(pow(2,120)), float("nan")], # Result
670 [0.0, pi
/ 2, pi
, 3 * pi
/ 2, 2 * pi
, 2.234567, 7, 8, pow(2,20), pow(2,24), pow(2,120), float("nan")] # Arg0
675 'arg_types' : [F
, F
, F
],
676 'function_type': 'ttt',
678 [0.0, 1.0, sin(M_PI_F
), -1.0, sin(2 * M_PI_F
), sin(2.234567), sin(7), sin(8), sin(pow(2,20)), sin(pow(2,24)), sin(pow(2,120)), float("nan")], # Result0
679 # using libm cosf(3.0f * M_PI / 2.0f) == 0x1.99bc5cp-27
680 # this is different form what python gives us
681 [1.0, cos(M_PI_F
/ 2), -1.0, float.fromhex('0x1.99bc5cp-27'), 1.0, cos(2.234567), cos(7), cos(8), cos(pow(2,20)), cos(pow(2,24)), cos(pow(2,120)), float("nan")], # Result1
682 [0.0, pi
/ 2, pi
, 3 * pi
/ 2, 2 * pi
, 2.234567, 7, 8, pow(2,20), pow(2,24), pow(2,120), float("nan")] # Arg0
688 'arg_types' : [F
, F
],
689 'function_type': 'ttt',
691 [0.0, sinh(0.123456789), float("inf"), float("-inf"), float("nan")],# Result
692 [0.0, 0.123456789, float("inf"), float("-inf"), float("nan")] # Arg0
697 'arg_types' : [F
, F
],
698 'function_type': 'ttt',
700 [0.0, 0.0, sin(pi
*pi
/2), sin(pi
*3*pi
/2), sin(2* M_PI_F
* pi
),
701 sin(pi
*1.12345), 0.0, 0.0, 0.0, 0.0, 0.0, float("nan")],#Result
702 [0.0, 1.0, pi
/ 2, 3 * pi
/ 2, 2 * pi
,
703 1.12345 , 7.0, 8.0, pow(2,20), pow(2,24), pow(2,120),
710 'function_type': 'ttt',
712 [1.0, 2.0, 6.0, 2.5 , float("nan"), 4.0, sqrt(0.0), sqrt(7.0), sqrt(pi
)], # Result
713 [1.0, 4.0, 36.0, 6.25, float("nan"), 16.0, 0.0, 7.0, pi
], # Arg1
719 'function_type': 'ttt',
721 [0.0, 1.0, tan(M_PI_F
), sqrt(3), -1.0, tan(2.234567), float("nan") ], # Result
722 [0.0, pi
/4, M_PI_F
, pi
/3, 3*pi
/4, 2.234567 , float("nan") ], # Arg1
727 'arg_types' : [F
, F
],
728 'function_type': 'ttt',
730 [0.0, tanh(0.123456789), tanh(15.123456789), 1.0, -1.0 , float("nan")],# Result
731 [0.0, 0.123456789, 15.123456789, float("inf"), float("-inf"), float("nan")] # Arg0
737 'function_type': 'ttt',
739 #fp32 representation of 2.234567 is 0x1.1e064ap+1
740 [0.0, 1.0, 0.0, sqrt(3), -1.0, tan(M_PI_F
* float.fromhex('0x1.1e064ap+1')), float("nan") ], # Result
741 [0.0, 1/4, 1, 1/3, 3/4, 2.234567, float("nan") ], # Arg1
747 'function_type': 'ttt',
749 [1.0, gamma(1.5), gamma(0.5), float("nan"), gamma(1.e
-15), float("nan")], # Result
750 [1.0, 1.5, 0.5, 0.0, 1.e
-15, float("nan")] # Arg
756 'function_type': 'ttt',
758 [0.0, -0.0, 0.0, -0.0, float("nan"), -3.0, 1.0],
759 [0.5, -0.5, 0.0, -0.0, float("nan"), -3.99, 1.5]
766 dirName
= os
.path
.join("cl", "builtin", "math")
769 functions
= sorted(tests
.keys())
770 for dataType
in DATA_TYPES
:
771 for fnName
in functions
:
772 testDefs
[(dataType
, fnName
)] = tests
[fnName
]
774 gen(DATA_TYPES
, CLC_VERSION_MIN
, functions
, testDefs
, dirName
)
777 if __name__
== '__main__':