Replies: 4 comments 5 replies
-
Welcome!
I'd be interested in some real world use cases for arbitrary precision computations. I would definitely like to have big integers in Numbat so we can perform computations with arbitrary large integers. But so far, I think I'm not 100% convinced that we definitely need arbitrary precision decimals. I mean, I would take them if we can get them from somewhere. But so far, I did not find a Rust crate that serves our purposes.
Mostly out of curiosity: which of these functions do you consider essential for a calculator like Numbat?
We'll work on that for sure. Let's discuss details in the other ticket.
Up until now, Numbat feels more like a functional programming language to me. So I would probably add lambdas, lists, and then
I mean, I'm biased — but I certainly share that vision for Numbat (maybe except for the arbitrary precision part, which I'm not yet sure about, see above).
I don't know. You can check out #19. And let us know in case you find something which better suits your needs 😄
🤩 |
Beta Was this translation helpful? Give feedback.
-
That sounds excellent! |
Beta Was this translation helpful? Give feedback.
-
Just came here to echo the sentiment that without arbitrary precision numbers (mostly I think about integers, though) numbat really cannot serve as a general-purpose calculator, which I'd really love it to be, since it already covers most of use cases I actually need ergonomic everyday calculator for (which is mostly stupid simple stuff, like unit conversion or basic operations in non-SI units, datetime operations, etc). I mean:
So all of combinatorics and probability (which, for me is probably the third most common use-case for day-to-day calculator) goes out of the window just like that. For some reference, kalker does this just fine, and it also is written in Rust and compiles to wasm, so maybe it's relevant. I didn't look into the actual implementation though. Edit: …However, now that I think of it, this probably has more with symbolic simplifications than with big integers. I mean, yes, kalker will tell me an exact value of 100!, which numbat cannot (and this is due to large integers/arbitrary precision), but it also will tell me that log(1 000 000!, 10) So, is it possible to make numbat more capable of tricks like that? |
Beta Was this translation helpful? Give feedback.
-
Yes, I've tried (and am using in general) only CLI version, so wasn't aware that web-version fails to do that.
Maybe. I still haven't taken a look at the source code. Indeed, kalker does it fine for 10 000 000, but thinks that log (100 000 000!, 10) = ∞, which isn't actually that big. So probably you are right. That being said, my concern is exclusively practical, so if this can be done purely by employing big int math — great. If this can be done with CAS, but only for a particular hand-selected case and not in general — also great. The motivation for the question is the desire to find a "calculator to rule them all" as the OP has put it, and while it's surely would be nice for it to handle even these huge examples, honestly, I've only tried it because of this thread. I've never really had a practical reason to estimate 100 000 000!. Finding something of order C(1000, 5) on the other hand — that happens all the time, and this is very cumbersome to do unless the calculator can handle 1000! (or just has C(n,k) implemented as a built-in). (...Or as a separately implemented user function, which also is perfectly doable, to be fair, but somehow it occurred to me only just now — probably because I never actually think about C(n,k) as a separate function, but instead as n!/k!(n-k)!, so that's what I always type into a calculator...) |
Beta Was this translation helpful? Give feedback.
-
I actually happened upon Numbat because I was looking for something akin to calc, an arbitrary precision calculator, which I could use on the web (on my phone). Better yet if it could merge that functionality with that of Units! I remembered a project called Insect which billed itself as "high precision" (which I think I interpreted as "arbitrary precision"), which brought me here. When I'm at my computer, I use calc for basically all one-off computations. It's great because it's fast, has runtime-configurable arbitrary precision, is scriptable in a C-like language, and includes a plethora of special functions and utility functions out of the box.
I would love to see Numbat fill this void. All it's really missing at the moment is support for arbitrary precision arithmetic and better function ergonomics to make user-contributed scripting more feasible. It would also be nice if it included useful control flow mechanics such as looping (though if tail call optimization is implemented, that's less of a big deal).
In the high-precision issue I did propose a finite-precision solution (based on quad-doubles) mostly as a stop-gap, but arbitrary precision could make this a very powerful tool.
What do people think about this vision? Am I barking up the wrong tree? Is there another WASM calculator project that I've missed? I did play around with QuickJS/QJSCalc for this purpose. It's quick, scriptable in JS, uses arbitrary precision, and is under a very permissive license, but it lacks robust typing and a unit system altogether. I feel like Numbat with arbitrary precision and "contrib" modules could tick all the boxes.
Beta Was this translation helpful? Give feedback.
All reactions