Scheme represents rational fractions exactly, as a pair of integers, and the integers can be of arbitrary length. This is part of the language standard. So a Scheme interpreter makes a pretty good calculator. (You can cast numbers into floating-point form, but they're tagged as inexact to remind you.)
Nice. I didn't realize the answer to that question was going to be quite so involved, or how much I was going to learn about programming from this. Thanks for checking it out!
Comments 3
Reply
Common Lisp does this too, and there’s a Ruby module for it. GMP has a nice-looking rational library. The idea seems to be catching on, and I’m glad.
Reply
Reply
Leave a comment