Anonymous user
Detect division by zero: Difference between revisions
→{{header|Lua}}: For 0/0 Lua returns -nan
(→{{header|Lua}}: division by zero fixed (a/b, where b == 0 may be inf or -inf, so it is not enough to check if a/b == 1/0)) |
(→{{header|Lua}}: For 0/0 Lua returns -nan) |
||
Line 1,219:
=={{header|Lua}}==
Lua, like Javascript, does not error on DIVIDE-BY-ZERO, but returns infinity, -infinity or -
<lang lua>local function div(a,b)
|