619 |
|
EPNODE *ep3 = ep1->sibling; |
620 |
|
if (ep1->type == NUM && ep3->type == NUM) { |
621 |
|
ep2 = rconst(ep2); |
622 |
< |
} else if (ep3->type == NUM && ep3->v.num == 0) { |
623 |
< |
if (ep2->type == '/') |
624 |
< |
syntax("divide by zero constant"); |
625 |
< |
ep1->sibling = NULL; /* (E2 * 0) */ |
626 |
< |
epfree(ep2); |
627 |
< |
ep2 = ep3; |
622 |
> |
} else if (ep3->type == NUM) { |
623 |
> |
if (ep2->type == '/') { |
624 |
> |
if (ep3->v.num == 0) |
625 |
> |
syntax("divide by zero constant"); |
626 |
> |
ep2->type = '*'; /* for speed */ |
627 |
> |
ep3->v.num = 1./ep3->v.num; |
628 |
> |
} else if (ep3->v.num == 0) { |
629 |
> |
ep1->sibling = NULL; /* (E2 * 0) */ |
630 |
> |
epfree(ep2); |
631 |
> |
ep2 = ep3; |
632 |
> |
} |
633 |
|
} else if (ep1->type == NUM && ep1->v.num == 0) { |
634 |
|
epfree(ep3); /* (0 * E3) or (0 / E3) */ |
635 |
|
ep1->sibling = NULL; |