4 ms·
>Note: you are not allowed to divide by zero. The result would be meaningless if you could. And 'NaN' is only something the computer spits out when it encoun
by gizmo686 13y ago
>Note: you are not allowed to divide by zero. The result would be meaningless if you could. And 'NaN' is only something the computer spits out when it encounters an operation that doesn't return a number. Usually, a computer will give you 'Inf' when you try to divide by zero numerically. Mathematically, you cannot do it. So don't try.
That is not true. You can mathematically divide by zero, just not over the Reals (or any other nonzero commutative ring). There is no reason that you cannot define a number system where division by zero is allowed, however in doing so you loose some nice properties that we enjoy about the Real numbers. A common example from math is the real projective line (which adds a point at infinity, and defines that a/0=infinity when a=/=0).
Another commonly used number system that defines division by zero is the IEEE floating-point standard. In fact, IEEE defines division for all values of 0 (it has a positive and a negative 0). Specifically:
a/+0=+infinity | a>0
a/+0=-infinity | a<0
a/-0 =-infinity | a>0
a/-0 = +infinity | a<0
0/0 = NaN | for any combination of 0 values
These definitions would cause floating point arithmetic to loose some nice properties of the Reals, however it provides the property of division being defined everywhere, and other decisions made already caused floating point arithmetic to not have the properties.
- coherentpony 13y ago>That is not true. You can mathematically divide by zero, just not over the Reals (or any other nonzero commutative ring). There is no reason that you cannot define a number system where division by zero is allowed, however in doing so you loose some nice properties that we enjoy about the Real numbers. A common example from math is the real projective line (which adds a point at infinity, and defines that a/0=infinity when a=/=0). I should have been a little clearer there. Thanks. I absolutely agree with you. But the domain and range of the functions I defined were all subsets of the reals. And computers don't deal with number systems other than the reals very well. (In fact, computers don't even deal with the reals themselves very well either!) There are some packages that allow one to operate over those spaces, but they are not commonly used in the commercial space. And, of course, it's fairly easy to extend the reals to the complexes. Thanks for pointing that out.