testFunction.h revision 206917
1 2/* 3=============================================================================== 4 5This C header file is part of TestFloat, Release 2a, a package of programs 6for testing the correctness of floating-point arithmetic complying to the 7IEC/IEEE Standard for Floating-Point. 8 9Written by John R. Hauser. More information is available through the Web 10page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'. 11 12THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort 13has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT 14TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO 15PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY 16AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE. 17 18Derivative works are acceptable, even for commercial purposes, so long as 19(1) they include prominent notice that the work is derivative, and (2) they 20include prominent notice akin to these four paragraphs for those parts of 21this code that are retained. 22 23=============================================================================== 24*/ 25 26enum { 27 INT32_TO_FLOAT32 = 1, 28 INT32_TO_FLOAT64, 29 INT32_TO_FLOATX80, 30 INT32_TO_FLOAT128, 31 INT64_TO_FLOAT32, 32 INT64_TO_FLOAT64, 33 INT64_TO_FLOATX80, 34 INT64_TO_FLOAT128, 35 FLOAT32_TO_INT32, 36 FLOAT32_TO_INT32_ROUND_TO_ZERO, 37 FLOAT32_TO_INT64, 38 FLOAT32_TO_INT64_ROUND_TO_ZERO, 39 FLOAT32_TO_FLOAT64, 40 FLOAT32_TO_FLOATX80, 41 FLOAT32_TO_FLOAT128, 42 FLOAT32_ROUND_TO_INT, 43 FLOAT32_ADD, 44 FLOAT32_SUB, 45 FLOAT32_MUL, 46 FLOAT32_DIV, 47 FLOAT32_REM, 48 FLOAT32_SQRT, 49 FLOAT32_EQ, 50 FLOAT32_LE, 51 FLOAT32_LT, 52 FLOAT32_EQ_SIGNALING, 53 FLOAT32_LE_QUIET, 54 FLOAT32_LT_QUIET, 55 FLOAT64_TO_INT32, 56 FLOAT64_TO_INT32_ROUND_TO_ZERO, 57 FLOAT64_TO_INT64, 58 FLOAT64_TO_INT64_ROUND_TO_ZERO, 59 FLOAT64_TO_FLOAT32, 60 FLOAT64_TO_FLOATX80, 61 FLOAT64_TO_FLOAT128, 62 FLOAT64_ROUND_TO_INT, 63 FLOAT64_ADD, 64 FLOAT64_SUB, 65 FLOAT64_MUL, 66 FLOAT64_DIV, 67 FLOAT64_REM, 68 FLOAT64_SQRT, 69 FLOAT64_EQ, 70 FLOAT64_LE, 71 FLOAT64_LT, 72 FLOAT64_EQ_SIGNALING, 73 FLOAT64_LE_QUIET, 74 FLOAT64_LT_QUIET, 75 FLOATX80_TO_INT32, 76 FLOATX80_TO_INT32_ROUND_TO_ZERO, 77 FLOATX80_TO_INT64, 78 FLOATX80_TO_INT64_ROUND_TO_ZERO, 79 FLOATX80_TO_FLOAT32, 80 FLOATX80_TO_FLOAT64, 81 FLOATX80_TO_FLOAT128, 82 FLOATX80_ROUND_TO_INT, 83 FLOATX80_ADD, 84 FLOATX80_SUB, 85 FLOATX80_MUL, 86 FLOATX80_DIV, 87 FLOATX80_REM, 88 FLOATX80_SQRT, 89 FLOATX80_EQ, 90 FLOATX80_LE, 91 FLOATX80_LT, 92 FLOATX80_EQ_SIGNALING, 93 FLOATX80_LE_QUIET, 94 FLOATX80_LT_QUIET, 95 FLOAT128_TO_INT32, 96 FLOAT128_TO_INT32_ROUND_TO_ZERO, 97 FLOAT128_TO_INT64, 98 FLOAT128_TO_INT64_ROUND_TO_ZERO, 99 FLOAT128_TO_FLOAT32, 100 FLOAT128_TO_FLOAT64, 101 FLOAT128_TO_FLOATX80, 102 FLOAT128_ROUND_TO_INT, 103 FLOAT128_ADD, 104 FLOAT128_SUB, 105 FLOAT128_MUL, 106 FLOAT128_DIV, 107 FLOAT128_REM, 108 FLOAT128_SQRT, 109 FLOAT128_EQ, 110 FLOAT128_LE, 111 FLOAT128_LT, 112 FLOAT128_EQ_SIGNALING, 113 FLOAT128_LE_QUIET, 114 FLOAT128_LT_QUIET, 115 NUM_FUNCTIONS 116}; 117 118typedef struct { 119 char *name; 120 int8 numInputs; 121 flag roundingPrecision, roundingMode; 122} functionT; 123extern const functionT functions[ NUM_FUNCTIONS ]; 124extern const flag functionExists[ NUM_FUNCTIONS ]; 125 126enum { 127 ROUND_NEAREST_EVEN = 1, 128 ROUND_TO_ZERO, 129 ROUND_DOWN, 130 ROUND_UP, 131 NUM_ROUNDINGMODES 132}; 133 134void testFunction( uint8, int8, int8 ); 135 136