Re: NAN and INF cast to int
| From: | Andrea Faulds | Date: | Thu, 02 Jan 2014 19:31:16 +0000 |
| Subject: | Re: NAN and INF cast to int | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-70964@lists.php.net to get a copy of this message | ||
On 02/01/14 19:08, Robert Stoll wrote:
And the other part about division by 0 yields false. I rethought it and conclude that it makes somewhat sense for a purely int division. However, it does not make sense for a floating point number division IMO and should be NAN or INF instead as suggested by IEEE 754. Yet, since this would be a BC break I understand that it cannot be changed in 5.x but maybe in PHP 6?Hey, why not make div-by-0 with ints also yield Infinity? It's a nicer and more practical approach than throwing a warning, IMO, because you don't have to check for zero at every single division, you'll just get an eventual output which tells you something went wrong. -- Andrea Faulds http://ajf.me/