Doing Arithmetic

Of course, a natural question at this point is, can you actually do arithmetic with these things? They’re pretty, and they’re interesting, but can you actually use them? Can you do arithmetic with them?

And the answer is heck yes (so long as you’re a computer).

For a long time, no one realized that. It took until 1972, when an interesting guy named Bill Gosper came up with a solution.[7] The full details of Gosper’s methods are pretty hairy, but the basic idea of the method isn’t that hard.

Gosper’s fundamental insight was that you could use what we now call lazy evaluation to do continued-fraction arithmetic. With lazy evaluation, you don’t need to compute the digits of a continued fraction all at once; you compute them ...

Get Good Math now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.