Hi Bob, > On 2 Jul 2015, at 01:26, Bob Weinand <bobw...@hotmail.com> wrote: > >> Am 29.06.2015 um 19:14 schrieb Andrea Faulds <a...@ajf.me>: >> >> Hmm. Using Error might make some sense given it used to raise E_WARNING. I >> think DivisionByZeroError sounds like a good idea. > > Hey, > > I just committed that to master…
Great! > But I noticed that intdiv(PHP_INT_MIN, -1) isn't very well suited for a > DivisionByZeroError. > > What do you think about adding an ArithmeticError for that case (and making > DivisionByZeroError subclass of it)? > That ArithmeticError could then be reused for negative bitshifts, which would > solve the question what to do with that too. Well, that specific case is integer overflow. Normally in PHP we just upgrade to float instead of throwing an error in these situations, but for intdiv() I didn’t think that made sense (it’s *integer* division). So, maybe OverflowError would be a better name. But we don’t really do overflow errors anywhere else that I can think of, so the more general ArithmeticError might be fine. Thanks. -- Andrea Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php