3 ms·
A really sly option would be to, effectively, allow infinitesimals. So 10/0 would return 10/0 (perhaps a kind of NaN but with more information retained), and if
by Tloewald 12y ago
A really sly option would be to, effectively, allow infinitesimals. So 10/0 would return 10/0 (perhaps a kind of NaN but with more information retained), and if you multiplied it by 0 elsewhere you'd get 10. Probably a bad idea for novice programmers but interesting to consider.
- jagger27 12y agoWorse yet, just return the highest possible value of the data type. Probably a 32bit integer.
- klodolph 12y agoNo, this is wrong. In order to work with infinitesimals in any reasonable way, you have to define how they work. There is a reasonable way to extend the real numbers in a larger field containing infinitesimals. Such a field is non-Archimedean and has very surprising properties: for example, you can construct a geometry in which Euclid's fifth postulate is false, and yet the angles on a triangle still always add up to 180. These fields also allow you to formalize your intuition about the way infinitesimals like "dx" and "dy" in calculus and analysis work: you can take an equation and multiply both sides by dx, for example. This is ordinarily meaningless, since the term dy/dx is ordinarily just notation that does not actually signify a fraction. In non-standard analysis, it IS a fraction. I think it's a shame that analysis classes in college don't use non-Archimedean fields because the proofs are so much simpler. However, even in these fields which admit infinitesimals, there is no definition for x/0. You can prove it for yourself. Suppose x = 10/0. 0*x = 10 (0+0)*x = 10 0*x + 0*x = 10 10 + 10 = 10 20 = 10 So this is just an all-around bad idea, because it permits us to say that 10 = 20. And all we had to say that 10/0 had a value... we didn't even say what that value was. P.S. Although infinitesimals exist, non-standard analysis still does not permit you to, say, plug ∞ into an equation, because there are many different infinite numbers. However, other systems (projective geometry) admit ∞ as a value.
- grkvlt 12y agoBut in an environment manipulating symbols where one of them 'x' has the property that multiplying by zero gives ten, I don't think the above sequence could happen, or at least the symbolic evaluator would arrange things so that the first time it sees '0 * x' it replaces that with 10. So to evaluate the truth of the expression '(a+b) * x = 10' with 'a' and 'b' equal to zero, we just need to ensure the 'a+b' is evaluated to zero before the multiplication, using the axiom 'n+0=n' and we are back to '0 * x' on the LHS, which is ten. I think it should be possible with appropriate precedence of the evaluation rules?
- Tloewald 12y agoRight, the same kind of arguments are the basis for calculus, and limit proofs work without being able to prove 1 = pi.
- klodolph 12y agoYou're turning something which is merely wrong into a total nightmare. Suddenly, 0+0 is not 0, because you have to wait to see if you multiply it by x first before you can evaluate 0+0! Now there are multiple distinct values for 0! Chaos and disharmony abound! In your system, 0+0=0+0, and 1+1=1+1. You can't simplify any of your equations! In your system, 1+1=2 is FALSE! No, seriously. Quit while you're ahead. Now that you know that dividing by zero and getting a result is not a logically consistent proposition, you can stop trying. That's the awesome thing about logic: once you PROVE something is impossible, you're done.
- deleted 12y ago[deleted]