2 rem tests if mawk has been compiled to correctly handle
3 rem floating point exceptions
5 echo testing division by zero
7 ..\mawk -f fpetest1.awk
8 if errorlevel 128 goto :test1_128
9 if errorlevel 3 goto :test1_3
10 if errorlevel 2 goto :test1_2
11 if errorlevel 1 goto :test1_1
29 ..\mawk -f fpetest2.awk
30 if errorlevel 128 goto :test2_128
31 if errorlevel 3 goto :test2_3
32 if errorlevel 2 goto :test2_2
33 if errorlevel 1 goto :test2_1
49 echo testing domain error
51 ..\mawk -f fpetest3.awk > temp$$
52 if errorlevel 128 goto :test3_128
53 if errorlevel 3 goto :test3_3
54 if errorlevel 2 goto :test3_2
55 if errorlevel 1 goto :test3_1
73 rem the returns should all be zero or all 2
75 echo *************************************
81 if %ret1% == 2 goto :okay1
82 if %ret1% == 0 goto :okay1
86 if %ret2% == 2 goto :okay2
87 if %ret2% == 0 goto :okay2
91 if %ret3% == 2 goto :okay3
92 if %ret3% == 0 goto :okay3
97 if %exception% == 1 goto :done
100 if %ret1% == %ret2% goto :same12
103 if %ret2% == %ret3% goto :same23
107 if %same% == 1 goto :same123
108 echo results are not consistent
109 echo return values should all be 0 if ignoring FPEs (e.g. with IEEE754)
110 echo or all 2 if trapping FPEs
114 if %ret1% == 0 goto :allzero
115 echo results consistent: trapping floating exceptions
119 echo results consistent: ignoring floating exceptions
120 grep -i nan temp$$ >NUL
121 if not errorlevel 1 goto :cleanup
122 echo but the library is not IEEE754 compatible
133 if %exception% == 1 goto :done1