| 1 |
-- Testcases for functions in rcomplex, based on syntax of cpython's |
| 2 |
-- cmath tests. |
| 3 |
-- |
| 4 |
-- Each line takes the form: |
| 5 |
-- |
| 6 |
-- <testid> <function> <input_value> [<input_value>] -> <output_value> <flags> |
| 7 |
-- |
| 8 |
-- where: |
| 9 |
-- |
| 10 |
-- <testid> is a short name identifying the test, |
| 11 |
-- |
| 12 |
-- <function> is the function to be tested (exp, cos, asinh, ...), |
| 13 |
-- |
| 14 |
-- <input_value> is either a pair or a quad of values separated by whitespace |
| 15 |
-- representing real and imaginary parts of a complex number, and |
| 16 |
-- |
| 17 |
-- <output_value> is the expected (ideal) output value, again |
| 18 |
-- represented as a pair of values. |
| 19 |
-- |
| 20 |
-- The values used may be a hex representation of a float beginning with |
| 21 |
-- '0x' or '0X' or a decimal representation of a float. |
| 22 |
-- |
| 23 |
-- <flags> is a list of the floating-point flags required by C99 |
| 24 |
-- |
| 25 |
-- The possible flags are: |
| 26 |
-- |
| 27 |
-- divide-by-zero : raised when a finite input gives a |
| 28 |
-- mathematically infinite result. |
| 29 |
-- |
| 30 |
-- overflow : raised when a finite input gives a finite result whose |
| 31 |
-- real or imaginary part is too large to fit in the usual range |
| 32 |
-- of an IEEE 754 double. |
| 33 |
-- |
| 34 |
-- invalid : raised for invalid inputs. |
| 35 |
-- |
| 36 |
-- ignore-real-sign : indicates that the sign of the real part of |
| 37 |
-- the result is unspecified; if the real part of the result is |
| 38 |
-- given as inf, then both -inf and inf should be accepted as |
| 39 |
-- correct. |
| 40 |
-- |
| 41 |
-- ignore-imag-sign : indicates that the sign of the imaginary part |
| 42 |
-- of the result is unspecified. |
| 43 |
-- |
| 44 |
-- Flags may appear in any order. |
| 45 |
-- |
| 46 |
-- Lines beginning with '--' (like this one) start a comment, and are |
| 47 |
-- ignored. Blank lines, or lines containing only whitespace, are also |
| 48 |
-- ignored. |
| 49 |
-- |
| 50 |
-- These tests are designed to excercise interesting values of functions, |
| 51 |
-- includind special values (+inf, -inf, nan, +0, -0, min_mantissa, |
| 52 |
-- min_exponent, max_mantissa, max_exponent) in both input and output, |
| 53 |
-- random values, and any branch cuts implicit in the function |
| 54 |
-- (non-continuities in function value) |
| 55 |
|
| 56 |
|
| 57 |
----------------------- |
| 58 |
-- pow: power -- |
| 59 |
----------------------- |
| 60 |
-- if x is 1.0, result is 1.0 |
| 61 |
pow0000 pow 1.0 0.0 0.0 0.0 -> 1.0 0.0 |
| 62 |
pow0001 pow 1.0 0.0 2.0 0.0 -> 1.0 0.0 |
| 63 |
pow0002 pow 1.0 0.0 0.0 2.0 -> 1.0 0.0 |
| 64 |
pow0003 pow 1.0 0.0 2.0 2.0 -> 1.0 0.0 |
| 65 |
pow0004 pow 1.0 0.0 inf 0.0 -> 1.0 0.0 |
| 66 |
pow0005 pow 1.0 0.0 0.0 inf -> 1.0 0.0 |
| 67 |
pow0006 pow 1.0 0.0 inf inf -> 1.0 0.0 |
| 68 |
pow0007 pow 1.0 0.0 -inf 0.0 -> 1.0 0.0 |
| 69 |
pow0008 pow 1.0 0.0 0.0 -inf -> 1.0 0.0 |
| 70 |
pow0009 pow 1.0 0.0 -inf -inf -> 1.0 0.0 |
| 71 |
pow0010 pow 1.0 0.0 nan 0.0 -> 1.0 0.0 |
| 72 |
pow0011 pow 1.0 0.0 0.0 nan -> 1.0 0.0 |
| 73 |
pow0012 pow 1.0 0.0 nan nan -> 1.0 0.0 |
| 74 |
-- if x is 0.0, result is +0 or -0 |
| 75 |
pow0020 pow 0.0 0.0 1.0 0.0 -> 0.0 0.0 |
| 76 |
-- if y is 0.0, result is 1.0 |
| 77 |
pow0021 pow 2.0 0.0 0.0 0.0 -> 1.0 0.0 |
| 78 |
pow0022 pow 0.0 2.0 0.0 0.0 -> 1.0 0.0 |
| 79 |
pow0023 pow 2.0 2.0 0.0 0.0 -> 1.0 0.0 |
| 80 |
pow0024 pow inf 0.0 0.0 0.0 -> 1.0 0.0 |
| 81 |
pow0025 pow 0.0 inf 0.0 0.0 -> 1.0 0.0 |
| 82 |
pow0026 pow inf inf 0.0 0.0 -> 1.0 0.0 |
| 83 |
pow0027 pow -inf 0.0 0.0 0.0 -> 1.0 0.0 |
| 84 |
pow0028 pow 0.0 -inf 0.0 0.0 -> 1.0 0.0 |
| 85 |
pow0029 pow -inf -inf 0.0 0.0 -> 1.0 0.0 |
| 86 |
pow0030 pow nan 0.0 0.0 0.0 -> 1.0 0.0 |
| 87 |
pow0031 pow 0.0 nan 0.0 0.0 -> 1.0 0.0 |
| 88 |
pow0032 pow nan nan 0.0 0.0 -> 1.0 0.0 |
| 89 |
|
| 90 |
pow0042 pow 2.0 0.0 inf 0.0 -> inf 0.0 |