Re: Re: Fix division by zero to throw exception
| From: | Levi Morrison | Date: | Fri, 03 Apr 2015 19:32:18 +0000 |
| Subject: | Re: Re: Fix division by zero to throw exception | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-85720@lists.php.net to get a copy of this message | ||
On Fri, Apr 3, 2015 at 1:31 PM, Levi Morrison <levim@php.net> wrote:
> On Fri, Apr 3, 2015 at 1:10 PM, Andrea Faulds <ajf@ajf.me> wrote:
>> Hi Dmitry,
>>
>>> On 3 Apr 2015, at 20:04, Dmitry Stogov <dmitry@zend.com> wrote:
>>>
>>> 2) Very similar weird behavior was introduced for shift with negative offsets. I also
>>> propose to change it in the same way (Fatal error at compile-time, Exception in run-time).
>>>
>>> Any thoughts? objections?
>>
>> For consistency with IEEE 754, shouldn't we produce INF on a division by zero, at
>> least for floats (but probably integers too because of weak typing)? I don't think producing a
>> warning is an issue, but FALSE isn't the right value to produce.
>
> I agree with Andrea. Currently we do floating point division even if
> both arguments are integers, and the correct behavior for a floating
> point divide by zero is to produce an INF or -INF.
Well, correct as defined by IEEE 754 anyway.