by mci · 6y ago · 0 comments
Here is a Python library that employs continued fractions to this end: [0]. You can pull successive partial quotients of the result from the root node of the dag. Whenever any node needs more precise input to deliver more precise output, it pulls a partial quotient from its argument(s).
Full disclosure: I wrote the original version of the library 13.5 years ago. Here are the slides from my talk about it: [1].
[0] https://github.com/AdamPrzybyla/python-cf
[1] https://marcinciura.files.wordpress.com/2019/10/cf-slides.pd...
https://news.ycombinator.com/item?id=24700705
The Android calculator app. got some nice usability improvements by using a combination of rationals, as described in this story, and recursive (aka constructive or computable) reals.
A previous post on Microsoft's calculator brought my attention to an old package it uses called Ratpack (aka ratpak), another implementation of rationals:
https://news.ycombinator.com/item?id=19321217
It has some nice properties for use in a calculator, but it can be quite slow.
When I come across a library with, shall we say, an exotic numeric representation, it's nice to have a library of mathematical functions included. I see that python-cf indeed includes a solid batch.
I do not see how this can be possible. Wouldn't that amount to prove a lot of hard math theorems (e.g, riemann hypothesis)?
# Idealistically inclined folks, who would prefer their
# computations to hang rather than to yield a heuristic result,
# can achieve this effect by setting accuracy to a negative
# value.