4 ms·
If we assume that we got to 0 because of a rounding error we do know that it should be some positive integer. I think that 1/0 = infinity is a reasonable subst
by optimuspaul 8y ago
If we assume that we got to 0 because of a rounding error we do know that it should be some positive integer. I think that 1/0 = infinity is a reasonable substitute for an actual value. 1/0 = 0 seems absurd. 1/(a number approaching 0) produces ever increasing integers.
I don't know, does it even matter? What happens when you try to divide a physical object into 0 parts? It doesn't create infinite pieces. It doesn't make the object disappear. Seems like nothing happened. Maybe when we divide by 0 in a program it should halt and catch fire?
I hate logical arguments, I get sucked in and start arguing all the positions.
- someone_is_here 8y agoIf you divide something 12 feet long into 3 parts, you don't get 4 parts, you get 3 parts that are each 4 feet long. So, if dividing a number by 0 yields infinity, you would expect that dividing something physical into 0 parts would yield 0 parts, each of infinite size, whatever that means. Sorry to be pedantic.
- behringer 8y agoIt's fine to be pedantic in math. You can't divide something 0 times, there's no solution for that. You can divide something by infinite times, but infinity is not 0. This might help explain things: https://www.math.utah.edu/~pa/math/0by0.html https://www.math.utah.edu/~pa/math/0by0.html
- ummonk 8y ago>If we assume that we got to 0 because of a rounding error we do know that it should be some positive integer. That's assuming we had rounding error from a positive number, not a negative number. Of course, if you are concerned about rounding, you shouldn't be using integer arithmetic. >1/(a number approaching 0) produces ever increasing integers. No. It produces a bunch of 0s, except when the denominator is 1 (where it produces 1) or the denominator is -1 (where it produces -1). Unless you're using a language like Python, in which case it produces -1 for all negative denominators.
- jschwartzi 8y agoActually if your embedded system will stop keeping a patient alive if you crash and the zero value doesn't cause any harm then you don't crash. There are lots of situations where it makes sense to keep computing even if you suspect the input data is wrong. It's not really good practice to always be crashing. You need to decide how to handle the bad input on a case-by-case basis.
- nemetroid 8y agoI think "crash" in these discussions generally refers to "abort the current action and return to a safe state".