Re: Fix division by zero to throw exception
| From: | Andrea Faulds | Date: | Fri, 03 Apr 2015 19:10:06 +0000 |
| Subject: | Re: Fix division by zero to throw exception | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-85717@lists.php.net to get a copy of this message | ||
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.
However there should be a compile-time solution. Maybe, if a division by zero happens, don't
evaluate the expression at compile-time?
Thanks.
--
Andrea Faulds
http://ajf.me/