More Intuitive Calculator Arithmetic (2018)

  • There's a related very nice article about the calculator in Android, by Hans-J. Boehm: https://cacm.acm.org/magazines/2017/8/219594-small-data-comp... Small-Data Computing: Correct Calculator Arithmetic

  • This is super neat! Desmos is one of my favorite tools. For anyone interested in efficient rational number representation, I highly recommend the entertaining article on "floating bar" for ray-tracing algorithms by Inigo Quilez

    https://iquilezles.org/www/articles/floatingbar/floatingbar....

  • > It took a while for us to settle on the idea of using rationals with limited-sized integers for the numerator and denominator and falling back to binary floating point when we have to. I doubt this idea is original—it’s a combination of a few well-established ideas—but I’m also not aware of any calculator (or programming language) that currently works this way.

    I am fairly sure this is exactly how my calculators (a Casio fx-115ES PLUS and a TI-89) work…

  • "I’m also not aware of any calculator (or programming language) that currently works this way." [represent fractions exactly wherever reasonable to do so]

    This is surprising to me!

    Casio scientific calculators definitely do this, and have done for many years now. And Casio (it appears) also represents pi and square roots exactly/symbolicly, wherever it's reasonable to do so.

  • tl;dr "We switched from floats to rationals."

    Because we made out calculator in JavaScript.

    Relatedly, lately I've been thinking of floats not as numbers but as number intervals. Their arithmetic doesn't really work that way but it's much better intuition for all the weirdness.