also detect 0/0

This commit is contained in:
ceriel 1988-08-05 11:40:29 +00:00
parent 905c5a349f
commit 05bac6c619

View file

@ -31,6 +31,15 @@ EXTEND *e1,*e2;
unsigned long result[2];
register unsigned long *lp;
if ((e2->m1 | e2->m2) == 0) {
/*
* Exception 8.2 - Divide by zero
*/
trap(EFDIVZ);
e1->m1 = e1->m2 = 0L;
e1->exp = EXT_MAX;
return;
}
if ((e1->m1 | e1->m2) == 0) { /* 0 / anything == 0 */
e1->exp = 0; /* make sure */
return;
@ -57,15 +66,6 @@ EXTEND *e1,*e2;
e1->m1 = e1->m2 = 0L;
return;
}
if ((e2->m1 | e2->m2) == 0) {
/*
* Exception 8.2 - Divide by zero
*/
trap(EFDIVZ);
e1->m1 = e1->m2 = 0L;
e1->exp = EXT_MAX;
return;
}
if (e1->exp >= EXT_MAX) {
/*
* Exception 8.3 - Overflow