Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -1 +1,2 @@
Write a function to detect a divide by zero error without checking if the denominator is zero.
Write a function to detect a divide by zero error
without checking if the denominator is zero.

View file

@ -0,0 +1,3 @@
---
category:
- Simple

View file

@ -0,0 +1,4 @@
(condition-case nil
(/ 1 0)
(arith-error
(message "Divide by zero (either integer or float)")))

View file

@ -0,0 +1,4 @@
iferr(1/0,
err,
print("division by 0"); print("or other non-invertible divisor"),
errname(err) == "e_INV");

View file

@ -1,5 +1,10 @@
/* A function is not required to detect division by zero. */
/* The following statement is executed anywhere prior to */
/* executing the statement containing the division by zero. */
Proc DivideDZ(a,b) Returns(Float Bin(33));
Dcl (a,b,c) Float Bin(33);
On ZeroDivide GoTo MyError;
c=a/b;
Return(c);
MyError:
Put Skip List('Divide by Zero Detected!');
End DivideDZ;
on zerodivide snap go to trap_zerodivide;
xx=DivideDZ(1,0);