Hacker News new | ask | show | jobs
by krick 2009 days ago
Nice. What I really want, though is a CLI calculator (something like bc or ipython) that would be clever enough to handle stuff like 1000!/999! (increase the number of digits if python will be able to do that: I hope you get the idea). I cannot treat seriously a calculator in 2020 that actually tries to evaluate expressions numerically, while representing numbers as floats or int32.

Multiplying matrices and stuff is nice, but I don't think I really ever needed that. But simple combinatorics and other calculations that involve large numbers and lots of simple operations (like powers), but are perfectly calculatable without losing precision on a piece of paper — plenty of times. It's annoying that I can calculate on a piece of paper something my calculator cannot.

Other than that, maybe some operations over physical units/unit conversion and some embedded city/timezone DB, and I don't think I can ask more of a calculator.

4 comments

Originally NoteCalc used a library for handling arbitrarily large numbers. Unfortunately, some operations were so slow that as a quick fix, I replaced the library with a lighter one without dynamic allocations (which is 96 bit integer with 28scale).

This serves well the primary goal of NoteCalc so I did not spend more time on it yet, but I am on the same page as you, and if NoteCalc will be feature-complete, I will give an other shot to arbitrarily large calculations/precision.

I actually started working on a CLI calculator a few days ago that sounds exactly like what you're looking for: https://github.com/Kevinpgalligan/ka

So far it just has variables and basic arithmetic. Other features on my roadmap: rational numbers, a type hierarchy, units, and lazy/smart combinatorics.

What do you imagine the timezone DB would look like? I'd love to hear your ideas!

Frink! https://frinklang.org/ sounds exactly what you want. It has built in bignum support and mathematical functions. It also does units and their conversation natively.

It runs on top of the JVM so there's an Android port also. The Android app appears as two icons. One as a simple calculator and the other as a simple scripting editor for more complex requirements.

Have you tried isympy? It handles your factorial expression easily.