The divide operator now returns infinity when the numerator is infinity, and raises "Division by zero" error only if the numerator is zero.
[INTERPRETER] * NEW: The divide operator now returns infinity when the numerator is infinity, and raises "Division by zero" error only if the numerator is zero.
This commit is contained in:
parent
f947fb176d
commit
c997255367
1 changed files with 4 additions and 4 deletions
|
@ -2187,7 +2187,7 @@ _DIV_INTEGER:
|
|||
VALUE_conv_float(&SP[-1]);
|
||||
VALUE_conv_float(SP);
|
||||
SP[-1]._float.value /= SP->_float.value;
|
||||
if (!isfinite(SP[-1]._float.value))
|
||||
if (!isfinite(SP[-1]._float.value) && SP->_float.value == 0)
|
||||
THROW(E_ZERO);
|
||||
goto _NEXT;
|
||||
|
||||
|
@ -2195,7 +2195,7 @@ _DIV_FLOAT:
|
|||
|
||||
SP--;
|
||||
SP[-1]._float.value /= SP->_float.value;
|
||||
if (!isfinite(SP[-1]._float.value))
|
||||
if (!isfinite(SP[-1]._float.value) && SP->_float.value == 0)
|
||||
THROW(E_ZERO);
|
||||
goto _NEXT;
|
||||
|
||||
|
@ -3473,7 +3473,7 @@ __FLOAT:
|
|||
__FLOAT_NC:
|
||||
|
||||
P1->_float.value /= P2->_float.value;
|
||||
if (isfinite(P1->_float.value))
|
||||
if (isfinite(P1->_float.value) || P2->_float.value)
|
||||
{
|
||||
SP--;
|
||||
return;
|
||||
|
@ -3489,7 +3489,7 @@ __SINGLE:
|
|||
__SINGLE_NC:
|
||||
|
||||
P1->_single.value /= P2->_single.value;
|
||||
if (isfinite(P1->_single.value))
|
||||
if (isfinite(P1->_single.value) || P2->_single.value)
|
||||
{
|
||||
SP--;
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue