On Thu, Jul 2, 2015 at 3:26 AM, Bob Weinand <bobw...@hotmail.com> wrote:
> > Am 29.06.2015 um 19:14 schrieb Andrea Faulds <a...@ajf.me>: > > > > Hi again, > > > >> On 29 Jun 2015, at 18:02, Bob Weinand <bobw...@hotmail.com> wrote: > >> > >> Yes, it generally makes sense... > >> Then I have other questions: > >> > >> - Why do we then still have a Warning? Either we have well-defined > behavior, or we throw an exception. Well-defined behavior *plus* a warning > is IMO non-sense. > > > > That’s weird, yeah. We don’t throw warnings for the math functions when > you give them odd inputs, e.g. sin(INF) is just NAN, no warning. > > > > I think removing it would make sense. > > > >> - Is it intentional for intdiv and % to throw an Exception instead of > Error or some more specific DivisionByZeroError or similar? (yes, I know, > Error is only very recent, but the question still needs to be asked). > > > > 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… > > 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. > I think we should introduce ArithmeticError, as you propose. Thanks. Dmitry. > > Thanks, > Bob