[HN Gopher] Show HN: val - An arbitrary precision calculator lan...
___________________________________________________________________
Show HN: val - An arbitrary precision calculator language
Wrote this to learn more about the `chumsky` parser combinator
library, rustyline, and the `ariadne` error reporting crate. Such
a nice DX combo for writing new languages. Still a work in
progress, but I thought I'd share :)
Author : crap
Score : 15 points
Date : 2025-04-17 19:51 UTC (3 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| jasonjmcghee wrote:
| Hey nice! We have similar interests. I built something similar,
| but with way less calculator functionality than you did :D
|
| But the main idea I was going for was real-time JIT evaluation
| with rendered errors (specifically learning / using cranelift
| JIT) - less to do with the calculator aspect.
|
| I ended up choosing miette for errors.
|
| https://github.com/jasonjmcghee/basic-treesitter-cranelift-j...
| occamatl wrote:
| > sqrt(10^100)-1 ->
| 100000000000000000000000000000000000000000000000000
|
| Not what I expected.
| emaro wrote:
| In the readme it says it uses double precision for numbers.
| Also not quite whet I expected from 'arbitrary precision'.
| chriswarbo wrote:
| Hmm, yeah. It cites `bc` as prior art, which is quite widely
| used; but another interesting arbitrary-precision calculator
| is spigot https://www.chiark.greenend.org.uk/~sgtatham/spigot
| /spigot.h...
| mananaysiempre wrote:
| Also the AOSP calculator, of course[1,2,3].
|
| [1] https://chadnauseam.com/coding/random/calculator-app
|
| [2] https://dl.acm.org/doi/10.1145/2911981
|
| [3] https://dl.acm.org/doi/10.1145/3385412.3386037
| primitivesuave wrote:
| The UI is awesome, amazing work! However, arbitrary precision
| implies that there is no fixed upper limit to the number of
| digits - simple tests like `0.1 + 0.2 == 0.3` and `2^53 == 2^53 +
| 1` (both produce "false") indicates you're still using IEEE 754
| double precision floats.
|
| If "arbitrary precision" is not as important to you as "high
| precision", a 128 bit decimal has enough precision for 99% of
| real-world applications.
| crap wrote:
| Thanks for checking it out! Should have been more clear that
| this is actively being worked on. This is ultimately the goal,
| and I'm currently working on integrating `astro_float` as the
| base for numbers.
| I_complete_me wrote:
| I wish you well. And I clicked you a star on github. Keep up the
| good work.
___________________________________________________________________
(page generated 2025-04-17 23:00 UTC)