Forgot your password?
typodupeerror

Submission + - What's the harm in a default setting for div by zero? 2

CodeInspired writes: After 20 years of programming, I've decided I'm tired of checking for div by zero. Would there be any serious harm in allowing a system wide setting that said div by zero simply equals zero? Maybe it exists already, not sure. But I run into it ALL the time in every language I've worked with. Does anyone want their div by zero errors to result in anything other than zero?
This discussion was created for logged-in users only, but now has been archived. No new comments can be posted.

What's the harm in a default setting for div by zero?

Comments Filter:
  • Who? People working on more critical things than you are, where the difference between 0 and an error state is important. A language/compiler option to change it to some other default behavior would be nice though.
  • I'm not a programmer, I know basic fortran and that's it, but surely you can just do something along the lines of: "IF (function) gives error THEN (function)=0" or is there some fundamental reason why a program can't divide by zero, catch itself trying to divide by zero and carry on using the value of zero (or whatever you want) as if the function returned zero in the first place?

The only possible interpretation of any research whatever in the `social sciences' is: some do, some don't. -- Ernest Rutherford

Working...