Safe division function
Posted
by bugspy.net
on Stack Overflow
See other posts from Stack Overflow
or by bugspy.net
Published on 2010-04-08T08:34:00Z
Indexed on
2010/04/08
8:43 UTC
Read the original article
Hit count: 117
c++
I would like to define some kind of safe division (and modulo) function, one that would return some predefined value when attempting to divide by zero. I don't want to throw exceptions, just to return some "reasonable" value (1? 0?) and continue the program flow. Obviously there is no correct return value, but I wonder if there is some standard or known approach to this
© Stack Overflow or respective owner