On Sun, Jul 5, 2015 at 4:39 PM, Levi Morrison <le...@php.net> wrote: > > > I just want to chime in and say that I have a contributed to a popular > application written in C that actually uses division by zero in a > useful manner. I feel like the rest of you think this is solely a > programmer error, and wanted to chime in to reiterate that this is not > the case. I would be in favor of removal of the error/warning and > *especially* would be against an exception for division by zero. > Division by zero as defined by IEEE 754 is actually useful which is > why it is often followed instead of sticking to a strict mathematical > definition where it is an error. > > I understand that some people are just upset about the > timing/discussion, which is possibly understandable - I have been too > busy lately to follow anything so I don't know. I just wanted to jump > in here and clarify the usefulness of what was actually changed. >
IEEE 754 is useful, I agree. The warning is also useful, because it helps the programmer find their mistake more easily. It gives you a file name and line number to look for. We have to remember that PHP is being used by a wide array of people with varying skillsets and expertise. Not all of them know what IEEE 754 is or even how to prevent division by zero. When they don't debugging the code that results in a division by zero means having to learn those things first. We're lowering the bar by just handing them the useful debug information. So removing the warning makes no sense. Having a warning in your error log screams at you that you potentially have a bug here and PHP shines a light on it for you so that you can either fix it or refactor the code to not result in this potentially buggy behavior. I don't think the point of this discussion was to discuss which is more useful, the warning or the error/exception. My immediate concern for raising this issue, initially, was that we suddenly ended up in a place where we had neither a warning nor an error, thereby leaving the user with no useful debug information whatsoever. No indication that there is potentially buggy code. That's bad. That should not have happened.