also detect 0/0
This commit is contained in:
parent
905c5a349f
commit
05bac6c619
|
@ -31,6 +31,15 @@ EXTEND *e1,*e2;
|
||||||
unsigned long result[2];
|
unsigned long result[2];
|
||||||
register unsigned long *lp;
|
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 */
|
if ((e1->m1 | e1->m2) == 0) { /* 0 / anything == 0 */
|
||||||
e1->exp = 0; /* make sure */
|
e1->exp = 0; /* make sure */
|
||||||
return;
|
return;
|
||||||
|
@ -57,15 +66,6 @@ EXTEND *e1,*e2;
|
||||||
e1->m1 = e1->m2 = 0L;
|
e1->m1 = e1->m2 = 0L;
|
||||||
return;
|
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) {
|
if (e1->exp >= EXT_MAX) {
|
||||||
/*
|
/*
|
||||||
* Exception 8.3 - Overflow
|
* Exception 8.3 - Overflow
|
||||||
|
|
Loading…
Reference in a new issue