Skip to main content


finding rational approximations of pi using #modal, no big deal
in reply to ⛧ esoterik ⛧

this is not as cool as i had hoped because it just hardcodes the first 14 terms of the continued fraction for pi, i.e. 3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1

https://oeis.org/A001203

(i did implement a generalized continued fraction which isn't hardcoded, but (A) it converges much more slowly and (B) it doesn't actually find the "best" convergents (e.g. 355/113) so it just didn't seem very useful.)

in reply to Devine Lu Linvega

@neauoire this is using the binary arithmetic rules i wrote (with 0 and 1), but it has to do a TON of division of large numbers, which is slow.
in reply to ⛧ esoterik ⛧

This is very nice! All in native numbers then.

I don't know if you saw, but I've started putting a x11 playground to draw modal programs to a framebuffer?

Fractals next?
https://git.sr.ht/~rabbits/thuesday

in reply to Devine Lu Linvega

@neauoire oh! yes! that would be super fun.

i need to port arith.modal to the number device you implemented. i think that should give at least a 10x speed up.

in reply to ⛧ esoterik ⛧

we're still figuring out how to do it right, so it might change still. But yeah, the fib example shows how it works a bit, the ?0-9 registers match values, and ?: on an operator is a kind of bang to evaluate an arithmetic operation.

Lo, thar be cookies on this site to keep track of your login. By clicking 'okay', you are CONSENTING to this.