On Sat, Apr 4, 2015 at 12:04 AM, Andrea Faulds <a...@ajf.me> wrote: > Hi, > > > On 3 Apr 2015, at 21:34, Dmitry Stogov <dmi...@zend.com> wrote: > > > > 3) One more problem is modulo :( > > > > $ sapi/cli/php -n -r "var_dump(1 % 0);" > > > > Warning: Division by zero in Command line code on line 1 > > bool(false) > > Hmm, modulo is a more difficult one. Since it’s an integer-only operation > in PHP, producing INF doesn’t make sense. It also doesn’t make sense > mathematically. I think the most sensible thing to do here would be to > throw an exception. > > On the same note, the new function intdiv() is the counterpart to % for > obtaining the quotient (% produces the remainder). It currently does the > same thing as % and / division and produces FALSE with a warning. If % is > changed, intdiv() should be too, because they are the same operation, just > returning different parts of the result. An exception being produced by > both would seem reasonable. >
Cool :) 4) fix intdiv() to throw exception. Thanks. Dmitry, > > Thanks. > > -- > Andrea Faulds > http://ajf.me/ > > > > >