1 : tests if mawk has been compiled to correctly handle
2 : floating point exceptions
4 test1='BEGIN{ print 4/0 }'
9 do { y = x ; x *= 1000 } while ( y != x )
10 print "loop terminated"
13 test3='BEGIN{ print log(-8) }'
16 echo "testing division by zero"
22 echo "testing overflow"
28 echo "testing domain error"
30 ./mawk "$test3" > temp$$
36 : the returns should all be zero or all 1
37 : core dumps not allowed
40 echo compilation defines for floating point are incorrect
45 echo ==============================
52 [ $ret1 -gt 128 ] && { echo test1 failed ; exception=1 ; }
53 [ $ret2 -gt 128 ] && { echo test2 failed ; exception=1 ; }
54 [ $ret3 -gt 128 ] && { echo test3 failed ; exception=1 ; }
56 [ "$exception" = 1 ] && { rm -f core temp$$ ; exit 1 ; }
61 [ $ret1 = $ret2 ] && [ $ret2 = $ret3 ] && same=1
68 echo results consistent: ignoring floating exceptions
69 if grep -i nan temp$$ > /dev/null
72 echo "but the library is not IEEE754 compatible"
76 else echo results consistent: trapping floating exceptions
84 echo results are not consistent
85 echo 'return values should all be 0 if ignoring FPEs (e.g. with IEEE754)
86 or all 1 if trapping FPEs'