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>
29 from genclbuiltins
import gen
, NEGNAN
30 from math
import acos
, acosh
, asin
, asinh
, atan
, atan2
, atanh
, cos
, cosh
, exp
, expm1
31 from math
import fabs
, fmod
, gamma
, hypot
, lgamma
, log
, log10
, log1p
, modf
, pi
, pow, sin
, sinh
, sqrt
, tan
, tanh
103 DATA_TYPES
= ['float']
117 M_PI_F
= float.fromhex('0x1.921fb6p+1')
120 return int(round(x
/y
))
124 'arg_types' : [F
, F
],
125 'function_type': 'ttt',
127 [ pi
, pi
/2, 0.0, acos(0.12345), float("nan")], # Result
128 [-1.0, 0.0, 1.0, 0.12345, float("nan")] # Arg0
133 'arg_types' : [F
, F
],
134 'function_type': 'ttt',
136 [0.0, acosh(1.12345), float("nan"), acosh(123456789.01234)], #Result
137 [1.0, 1.12345, float("nan"), 123456789.01234 ] #Arg0
142 'arg_types' : [F
, F
],
143 'function_type': 'ttt',
145 [ 1, 1/2, 0.0, acos(0.12345) / pi
, float("nan")], # Result
146 [-1.0, 0.0, 1.0, 0.12345, float("nan")] # Arg0
151 'arg_types' : [F
, F
],
152 'function_type': 'ttt',
154 [-pi
/2, 0.0, pi
/2, asin(0.12345), float("nan")], # Result
155 [-1.0, 0.0, 1.0, 0.12345, float("nan")] # Arg0
160 'arg_types' : [F
, F
],
161 'function_type': 'ttt',
163 [0.0, asinh(1.0), asinh(-1.12345), float("nan"), asinh(123456789.01234)], #Result
164 [0.0, 1.0, -1.12345, float("nan"), 123456789.01234 ] #Arg0
169 'arg_types' : [F
, F
],
170 'function_type': 'ttt',
172 [-1/2, 0.0, 1/2, asin(0.12345)/pi
, float("nan")], # Result
173 [-1.0, 0.0, 1.0, 0.12345, float("nan")] # Arg0
178 'arg_types' : [F
, F
],
179 'function_type': 'ttt',
181 [atan(0.0), atan(0.12345), atan(3567147.0)], # Result
182 [0.0, 0.12345, 3567147.0]# Arg0
187 'arg_types' : [F
, F
, F
],
188 'function_type': 'ttt',
190 [atan2(0.0, 0.0), atan2(1.2345, 10.0), atan2(35671470.0, 0.1)], # Result
191 [0.0, 1.2345, 35671470.0 ], # Arg0
192 [0.0, 10.0, 0.1 ] # Arg1
197 'arg_types' : [F
, F
, F
],
198 'function_type': 'ttt',
200 [atan2(0.0, 0.0)/pi
, atan2(1.2345, 10.0)/pi
, atan2(35671470.0, 0.1)/pi
], # Result
201 [0.0, 1.2345, 35671470.0 ], # Arg0
202 [0.0, 10.0, 0.1 ] # Arg1
207 'arg_types' : [F
, F
],
208 'function_type': 'ttt',
210 [0.0, float("inf"), float("-inf"), float("nan"), atanh(0.123456789)], #Result
211 [0.0, 1.0, -1.0, float("nan"), 0.123456789 ] #Arg0
216 'arg_types' : [F
, F
],
217 'function_type': 'ttt',
219 [0.0, -0.0, atan(1.02345)/pi
, atan(-1.02345)/pi
, float("nan"), 0.5, -0.5 ],
220 [0.0, -0.0, 1.02345, -1.02345, float("nan"), float("inf"), float("-inf") ]
226 'function_type': 'ttt',
228 [3.0, -1.0, float("nan"), float("inf"), 0.123456789**(1/3.0) ],
229 [27.0, -1.0, float("nan"), float("inf"), 0.123456789 ]
235 'function_type': 'ttt',
237 [1.0, 0.0, 0.0, -0.0, float("nan"), -3.0],
238 [0.5, -0.5, 0.0, -0.0, float("nan"), -3.99]
242 'arg_types': [F
, F
, F
],
243 'function_type': 'ttt',
245 [0.0, -0.0, 1.0, -1.0, float("nan"), float("nan"), NEGNAN
, float("-inf"), float("inf") ], # Result
246 [0.0, 0.0, 1.0, -1.0, float("nan"), -4.0, float("nan"), float("inf"), float("-inf") ], # Arg0
247 [1.0, -1.0, 2.0, -2.0, float("nan"), float("nan"), -4.0, -3.0, float("inf") ], # Arg1
251 'arg_types' : [F
, F
],
252 'function_type': 'ttt',
254 # using libm cosf(3.0f * M_PI / 2.0f) == 0x1.99bc5cp-27
255 # this is different form what python gives us
256 [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
257 [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
262 'arg_types' : [F
, F
],
263 'function_type': 'ttt',
265 [1.0, cosh(0.123456789), float("inf"), float("inf"), float("nan")],# Result
266 [0.0, 0.123456789, float("inf"), float("-inf"), float("nan")] # Arg0
271 'arg_types' : [F
, F
],
272 'function_type': 'ttt',
274 [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
275 [0.0, pi
/ 2, 3 * pi
/ 2, 2 * pi
, 1.12345 , pow(2,20), pow(2,24), pow(2,120), float("nan")] # Arg0
280 'arg_types' : [F
, F
],
281 'function_type': 'ttt',
283 [0.0, 0.950004, 0.990005, -0.994999475, 1.0, 1, -1], # Result
284 [0.0, 1.960/sqrt(2.0), 2.576/sqrt(2.0), -2.807/sqrt(2.0), 11.1, float("inf"), float("-inf")] # Arg0
289 'arg_types' : [F
, F
],
290 'function_type': 'ttt',
292 [1.0, float.fromhex('0x1.9990c6p-5'), float.fromhex('0x1.4784aep-7'), 1.994999, 0.0, 0.0, 2.0], # Result
293 [0.0, 1.960/sqrt(2.0), 2.576/sqrt(2.0), -2.807/sqrt(2.0), 11.1, float("inf"), float("-inf")] # Arg0
298 'arg_types' : [F
, F
],
299 'function_type': 'ttt',
301 [1.0, exp(0.95), exp(pi
), exp(-pi
), float("inf"), float.fromhex('0x1.66fe8ap+4')], # Result
302 [0.0, 0.95, pi
, -pi
, float("inf"), float.fromhex('0x1.8e2cp+1')] # Arg0
307 'arg_types' : [F
, F
],
308 'function_type': 'ttt',
310 [1.0, 10 ** 0.95, 10 ** pi
, 10 ** -pi
, float("inf"), float.fromhex('0x1.4298593c335e3p+10')], # Result
311 [0.0, 0.95, pi
, -pi
, float("inf"), float.fromhex('0x1.8e2cp+1')] # Arg0
316 'arg_types' : [F
, F
],
317 'function_type': 'ttt',
319 [1.0, 2 ** 0.95, 2 ** pi
, 2 ** -pi
, float("inf"), float.fromhex('0x1.146b7fd8431e3p+3')], # Result
320 [0.0, 0.95, pi
, -pi
, float("inf"), float.fromhex('0x1.8e2cp+1')] # Arg0
325 'arg_types' : [F
, F
],
326 'function_type': 'ttt',
328 [0.0, expm1(0.95), expm1(pi
), expm1(-pi
), float("inf"), float.fromhex('0x1.56fe8a160893ep+4')], # Result
329 [0.0, 0.95, pi
, -pi
, float("inf"), float.fromhex('0x1.8e2cp+1')] # Arg0
334 'arg_types' : [F
, F
],
335 'function_type': 'ttt',
337 [0.0, pi
/2, pi
, 0.0, float("inf"), float("inf"), 1.12345 ], # Result
338 [0.0, -pi
/2, pi
, -0.0, float("-inf"), float("inf"), -1.12345] # Arg0
343 'arg_types' : [F
, F
, F
],
344 'function_type': 'ttt',
346 [0.0, 0.75, 0.0, 0.0, float("inf"), 0.0, float("nan"), float("nan"), float("nan"), 2.2469 ], # Result
347 [0.3, 1.0, pi
, 0.0, float("inf"), float("inf"), float("nan"), 1.0, float("nan"), 1.12345 ], # Arg0
348 [1.5, 0.25, pi
, -0.0, float("-inf"), float("inf"), float("nan"), float("nan"), 1.0, -1.12345] # Arg1
353 'function_type': 'ttt',
355 [0.0, -1.0, 0.0, -0.0, float("nan"), -4.0, 1.0],
356 [0.5, -0.5, 0.0, -0.0, float("nan"), -3.99, 1.5]
360 'arg_types': [F
, F
, F
, F
],
361 'function_type': 'tss',
363 [pi
, 1.0, pi
, -0.5, float("nan"), float("nan"), float("nan")], # Result
364 [1.0, pi
, 0.0, 0.0, 1.0, float("nan"), float("nan")], # Arg0
365 [pi
, 0.0, pi
, -0.5, float("nan"), 1.0, float("nan")], # Arg1
366 [0.0, 1.0, pi
, -0.5, float("nan"), 1.0, float("nan")] # Arg2
370 'arg_types': [F
, F
, F
],
371 'function_type': 'tss',
373 [1.0, 0.0, 0.0, 0.0, 1.0, 1.0, float("nan")], #Result
374 [1.0, -0.5, 0.0, 0.0, 1.0, float("nan"), float("nan")], #Arg0
375 [0.0, 0.0, 0.0, -0.5, float("nan"), 1.0, float("nan")] #Arg1
379 'arg_types': [F
, F
, F
],
380 'function_type': 'tss',
382 [0.0, -0.5, 0.0, -0.5, 1.0, 1.0, float("nan")], #Result
383 [1.0, -0.5, 0.0, 0.0, 1.0, float("nan"), float("nan")], #Arg0
384 [0.0, 0.0, 0.0, -0.5, float("nan"), 1.0, float("nan")] #Arg1
388 'arg_types': [F
, F
, F
],
389 'function_type': 'ttt',
391 [float.fromhex("0x1.99998p-4"), float("nan"), float.fromhex("-0x1.47aep-7"), 1.0, float("-nan"), float("nan")],
392 [float.fromhex("0x1.466666p+2"), 0.0, float.fromhex("-0x1p+2"), 1.0, 5.1, 3.0 ],
393 [float.fromhex("0x1p-1"), float("nan"), float.fromhex("-0x1.feb852p+1"), 1.5, 0.0, float("inf")]
398 'arg_types': [F
, F
, F
],
399 'function_type': 'ttt',
400 # For fract we have two outputs per address space.
402 [float("nan"), 0.0, 0.5, 0.0, float.fromhex('0x1.33333p-2'), float.fromhex('0x1.fffffep-1') ], #fract
403 [float("nan"), float("inf"), 1.0, 2.0, -2.0, -1.0], #floor
404 [float("nan"), float("inf"), 1.5, 2.0,float.fromhex('-0x1.b33334p+0'), float.fromhex('-0x1.000242p-24')] #src0
409 'arg_types': [F
, I
, F
],
410 'function_type': 'ttt',
411 # For frexp we have two outputs per address space.
413 [0.602783203125, 0.5, float("nan"), float("nan"), float("inf"), float("-inf"), 0.0],
414 [11, 1, 0, 0, 0, 0, 0],
415 [1234.5, 1.0, float("nan"), float("-nan"), float("inf"), float("-inf"), 0.0]
420 'arg_types': [F
, F
, F
],
421 'function_type': 'ttt',
423 [hypot(0, 1.0), hypot(3, 10.0), hypot(1, -3.0), hypot(10, 1234.5), hypot(2147483647, -1.0), float("inf")], # Result
424 [0, 3, 1, 10, 2147483647, 2147483647], # Arg0
425 [1.0, 10.0, -3.0, 1234.5, -1.0, float("-inf")] # Arg1
431 'function_type': 'ttt',
433 [0, 3, 1, 10, 2147483647, 2147483647],
434 [1.0, 10.0, -3.0, 1234.5, float("inf"), float("-inf")]
439 'arg_types': [F
, F
, I
],
440 'function_type': 'tss',
442 [0.0, 4.0, 15.2, 1.75, float("nan"), float("inf")],
443 [0.0, 1.0, 0.95, 3.5, float("nan"), 1.12312312],
444 [0, 2, 4, -1, 1, 2031231231]
450 'function_type': 'ttt',
452 [0.0, lgamma(1.5), lgamma(0.5), float("nan"), lgamma(1.e
-15), float("nan")], # Result
453 [1.0, 1.5, 0.5, 0.0, 1.e
-15, float("nan")] # Arg
455 'tolerance' : 16777216 # Specs say it's currently undefined
458 'arg_types': [F
, I
, F
],
459 'function_type': 'ttt',
461 [0.0, lgamma(1.5), lgamma(0.5), float("nan"), lgamma(1.e
-15), float("nan")], # Result0
462 [1, -1, 1, 1, 1, 1], # Result1
463 [1.0, 1.5, 0.5, 0.0, 1.e
-15, float("nan")] # Arg
465 'tolerance' : 16777216, # Specs say it's currently undefined
470 'function_type': 'ttt',
472 [log(0.5), float("-inf"), log(1.e
-15), float("nan")], #Result
473 [0.5, 0.0, 1.e
-15, float("nan")] #Arg0
479 'function_type': 'ttt',
481 [log10(0.5), float("-inf"), log10(1.e
-15), float("nan")],
482 [0.5, 0.0, 1.e
-15, float("nan")]
488 'function_type': 'ttt',
490 [log1p(0.5), float("-inf"), log1p(1.e
-15), float("nan")],
491 [0.5, -1.0, 1.e
-15, float("nan")]
497 'function_type': 'ttt',
499 [log(0.5, 2), float("-inf"), log(1.e
-15, 2), float("nan")], #Result
500 [0.5, 0.0, 1.e
-15, float("nan")] #Arg0
506 'function_type': 'ttt',
508 [0, 3, 1, 10, float("inf"), float("inf")], #Result
509 [1.0, 10.0, -3.0, 1234.5, float("inf"), float("-inf")] #Arg0
514 'arg_types': [F
, F
, F
, F
],
515 'function_type': 'tss',
517 [pi
, 1.0, pi
, -0.5, float("nan"), float("nan"), float("nan")], # Result
518 [1.0, pi
, 0.0, 0.0, 1.0, float("nan"), float("nan")], # Arg0
519 [pi
, 0.0, pi
, -0.5, float("nan"), 1.0, float("nan")], # Arg1
520 [0.0, 1.0, pi
, -0.5, float("nan"), 1.0, float("nan")] # Arg2
522 'tolerance' : 16777216 #infinite ULP
525 'arg_types': [F
, F
, F
],
526 'function_type': 'ttt',
528 [1.0, -0.5, 0.0, -0.5, 1.0, 1.0, float("nan")], #Result
529 [1.0, -0.5, 0.0, 0.0, 1.0, float("nan"), float("nan")], #Arg0
530 [0.0, 0.0, 0.0, -0.5, float("nan"), 1.0, float("nan")] #Arg1
534 'arg_types': [F
, F
, F
],
535 'function_type': 'ttt',
537 [0.0, -0.5, 0.0, 1.0, 1.0, 1.0, float("nan")], #Result
538 [1.0, -0.5, 1.0, 1.0, 1.0, float("nan"), float("nan")], #Arg0
539 [0.0, 1.0, 0.0, -1.5, float("nan"), 1.0, float("nan")] #Arg1
543 'arg_types': [F
, F
, F
],
544 'function_type': 'ttt',
546 [0.0, modf(1.5)[0], modf(0.25)[0], 0.0, modf(1.e
-15)[0], float("nan")], # Result0
547 [1, modf(1.5)[1], modf(0.25)[1], 0.0, modf(1.e
-15)[1], float("nan")], # Result1
548 [1.0, 1.5, 0.25, 0.0, 1.e
-15, float("nan")] # Arg
552 # FIXME: kernel names are broken, and we can't really compare nans to see if the
555 # 'arg_types': [F, U],
556 # 'function_type': 'ttt',
558 # [float("nan"), float("nan"), float("nan")],
559 # [0xdead, 0xadbeef, 0xdead]
564 'arg_types': [F
, F
, F
],
565 'function_type': 'ttt',
567 [1.401298e-45, -1.401298e-45, 1.00000011920928955078125, 0.999999940395355224609375, float("nan"), float("nan"), 5.0 ], # Result
568 [0.0, 0.0 , 1.0, 1.0, float("nan"), 2.5, 5.0], # Arg0
569 [1.0, -1.0 , 2.0, 0.0, 3.4, float("nan"), 5.0], # Arg1
573 'arg_types': [F
, F
, F
],
574 'function_type': 'ttt',
576 [pow(0, 1.0), pow(-3, 10.0), pow(-11, -3.0), pow(1234.5, 10), pow(2147483647, -1.0), float("inf")], # Result
577 [0, -3, -11, 1234.5, 2147483647, 2147483647], # Arg0
578 [1.0, 10.0, -3.0, 10, -1.0, float("-inf")] # Arg1
583 'arg_types': [F
, F
, I
],
584 'function_type': 'ttt',
586 [pow(1, 0), pow(10.0, 3), pow(-3.3, -4), pow(1234, 10), pow(-1, 2147483647), float("-inf")], # Result
587 [1.0, 10.0, -3.3, 1234, -1.0, float("-inf")], # Arg0
588 [0, 3, -4, 10, 2147483647, 2147483647] # Arg1
593 'arg_types': [F
, F
, F
],
594 'function_type': 'ttt',
596 [pow(0, 1.0), pow(3, 10.0), pow(11, -3.0), pow(1234.5, 10), pow(2147483647, -1.0), 0.0], # Result
597 [0, 3, 11, 1234.5, 2147483647, 2147483647], # Arg0
598 [1.0, 10.0, -3.0, 10, -1.0, float("-inf")] # Arg1
603 'arg_types': [F
, F
, F
],
604 'function_type': 'ttt',
606 [float.fromhex("-0x1.ccccdp-1"), float.fromhex("0x1.ccccdp-1"),
607 float.fromhex("-0x1.ccccdp-1"), float.fromhex("0x1.ccccdp-1"),
608 0.0, -0.0, 5.1, float("-nan")
610 [ 5.1, -5.1, 5.1, -5.1, 0.0, -0.0, 5.1, 5.1], # Arg0
611 [ 3.0, 3.0, -3.0, -3.0, 1.0, 1.0, float("inf"), 0.0], # Arg1
615 'arg_types': [F
, I
, F
, F
],
616 'function_type': 'ttt',
618 [float.fromhex("-0x1.ccccdp-1"), float.fromhex("0x1.ccccdp-1"),
619 float.fromhex("-0x1.ccccdp-1"), float.fromhex("0x1.ccccdp-1"),
620 0.0, -0.0, 5.1, float("-nan")
622 [quo(5.1, 3.0), quo(-5.1, 3.0), quo(5.1, -3.0), quo(-5.1, -3.0),
623 quo(0.0, 1.0), quo(-0.0, 1.0), quo(5.1, float("inf")), 0], # Arg0
624 [ 5.1, -5.1, 5.1, -5.1, 0.0, -0.0, 5.1, 5.1], # Arg0
625 [ 3.0, 3.0, -3.0, -3.0, 1.0, 1.0, float("inf"), 0.0], # Arg1
631 'function_type': 'ttt',
633 [0.0, -0.0, 1.0, -1.0, float("nan"), -4.0, 2.0, 0.0, 1.0],
634 [0.5, -0.5, 0.6, -0.6, float("nan"), -3.99, 1.5, 0.4, 0.6]
638 'arg_types': [F
, F
, I
],
639 'function_type': 'ttt',
641 [pow(1, 1/2), pow(10.0, 1/3), float("nan"), pow(1234, 1/10), -1, float("-inf")], # Result
642 [1.0, 10.0, -3.3, 1234, -1.0, float("-inf")], # Arg0
643 [2, 3, -4, 10, 2147483647, 2147483647] # Arg1
649 'function_type': 'ttt',
651 [1.0, -1.0, 0.0, -0.0, float("nan"), -4.0, 2.0, 0.0, 1.0],
652 [0.5, -0.5, 0.0, -0.0, float("nan"), -3.99, 1.5, 0.4, 0.6]
657 'function_type': 'ttt',
659 [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
660 [1.0, 4.0, 36.0, 6.25, float("nan"), 16.0, 0.0, 7.0, pi
], # Arg1
665 'arg_types' : [F
, F
],
666 'function_type': 'ttt',
668 [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
669 [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
674 'arg_types' : [F
, F
, F
],
675 'function_type': 'ttt',
677 [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
678 # using libm cosf(3.0f * M_PI / 2.0f) == 0x1.99bc5cp-27
679 # this is different form what python gives us
680 [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
681 [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
687 'arg_types' : [F
, F
],
688 'function_type': 'ttt',
690 [0.0, sinh(0.123456789), float("inf"), float("-inf"), float("nan")],# Result
691 [0.0, 0.123456789, float("inf"), float("-inf"), float("nan")] # Arg0
696 'arg_types' : [F
, F
],
697 'function_type': 'ttt',
699 [0.0, 0.0, sin(pi
*pi
/2), sin(pi
*3*pi
/2), sin(2* M_PI_F
* pi
),
700 sin(pi
*1.12345), 0.0, 0.0, 0.0, 0.0, 0.0, float("nan")],#Result
701 [0.0, 1.0, pi
/ 2, 3 * pi
/ 2, 2 * pi
,
702 1.12345 , 7.0, 8.0, pow(2,20), pow(2,24), pow(2,120),
709 'function_type': 'ttt',
711 [1.0, 2.0, 6.0, 2.5 , float("nan"), 4.0, sqrt(0.0), sqrt(7.0), sqrt(pi
)], # Result
712 [1.0, 4.0, 36.0, 6.25, float("nan"), 16.0, 0.0, 7.0, pi
], # Arg1
718 'function_type': 'ttt',
720 [0.0, 1.0, tan(M_PI_F
), sqrt(3), -1.0, tan(2.234567), float("nan") ], # Result
721 [0.0, pi
/4, M_PI_F
, pi
/3, 3*pi
/4, 2.234567 , float("nan") ], # Arg1
726 'arg_types' : [F
, F
],
727 'function_type': 'ttt',
729 [0.0, tanh(0.123456789), tanh(15.123456789), 1.0, -1.0 , float("nan")],# Result
730 [0.0, 0.123456789, 15.123456789, float("inf"), float("-inf"), float("nan")] # Arg0
736 'function_type': 'ttt',
738 #fp32 representation of 2.234567 is 0x1.1e064ap+1
739 [0.0, 1.0, 0.0, sqrt(3), -1.0, tan(M_PI_F
* float.fromhex('0x1.1e064ap+1')), float("nan") ], # Result
740 [0.0, 1/4, 1, 1/3, 3/4, 2.234567, float("nan") ], # Arg1
746 'function_type': 'ttt',
748 [1.0, gamma(1.5), gamma(0.5), float("nan"), gamma(1.e
-15), float("nan")], # Result
749 [1.0, 1.5, 0.5, 0.0, 1.e
-15, float("nan")] # Arg
755 'function_type': 'ttt',
757 [0.0, -0.0, 0.0, -0.0, float("nan"), -3.0, 1.0],
758 [0.5, -0.5, 0.0, -0.0, float("nan"), -3.99, 1.5]
765 dirName
= os
.path
.join("cl", "builtin", "math")
768 functions
= sorted(tests
.keys())
769 for dataType
in DATA_TYPES
:
770 for fnName
in functions
:
771 testDefs
[(dataType
, fnName
)] = tests
[fnName
]
773 gen(DATA_TYPES
, CLC_VERSION_MIN
, functions
, testDefs
, dirName
)
776 if __name__
== '__main__':