Task

Write a function to detect a   divide by zero error   without checking if the denominator is zero.




        define('zdiv(x,y)') :(zdiv_end)
zdiv    &errlimit = 1; setexit(.ztrap)
        zdiv = x / y :(return)
ztrap   zdiv = ?(&errtype ? (14 | 262)) 'Division by zero' :s(continue)f(abort)
zdiv_end
 
*       # Test and display
        output = '1/1     = ' zdiv(1,1)      ;* Integers non-zero
        output = '1.0/1.0 = ' zdiv(1.0,1.0)  ;* Reals non-zero
        output = '1/0     = ' zdiv(1,0)      ;* Integers zero
        output = '1.0/0.0 = ' zdiv(1.0,0.0)  ;* Reals zero
        output = 'Zero checks complete'
end