I ve been working on Fractions in Code. They make it possible to record things like division by zero as a value, which makes things interesting.

If you calculate how many pieces of one cake can give to two people, you will get half each. 1 cake / 2 people. For one person, it s one cake each - 1 cake / 1 person. It gets interesting when you have half a person. You would have 1 cake / 0.5 people. We can t represent a fraction like that - so we multiply both sides by the minimum value you would need to make the denominator (bottom number) a whole number, and it becomes 2 / 1. As you move towards 0 people, the number of cakes increases. 0.25 people get 4 cakes each. 1 / 0.25 or 4 / 1. Extrapolating, we get 1 / 0 equals infinity.

--- YOUR ANSWER IS HERE ---

Zero can be represented as 0 / n. To get the reciprocal of a fraction, we simply flip it on its head - so we get n / 0 which is (according to the cake example above) infinity.

--- END ANSWER ---

Infinity is not undefined. "Undefined" or "Does Not Exist" or "NaN" (Not a Number) are error conditions for number systems that do not support such difficult calculations. IEEE Floating Point Standards define PositiveInfinity and NegativeInfinity, but declare that PositiveInfinity * 0 = NaN. We can simplify matters by declaring that *any* number multiplied by zero *must be* zero, and with Fractions, we can support that.

If you really want to twist your mellon, think about this: What is the value of 0 / 0? Answer: If we draw out a graph of x / y, we find that the value increases the closer y gets to zero. But at the same time, it decreases the closer x gets to zero. Since 1 / y tends towards +infinity as y approaches zero, and we know 1 / 0 = infinity, we could say that 2 / 0 = 2 * infinity. Similarly 0.5 / 0 = 0.5 * infinity, and so forth, and 0 / 0 = 0 * infinity which equals zero.