Show HN: All desktop software calculators are wrong, so I had to build my own

286 points by chacha21 ↗ HN
A new calculator software cannot really bring attention (https://chachatelier.fr/chalk/)

However, I wrote a full article explaining why I had to build something "new" that does not behave like usual desktop calculator softwares :

<https://chachatelier.fr/chalk/article/chalk.html>

TL;DR All "small" calculator softwares I know share the same design flaws. And the GUI is not the only stumbling block in their poor efficiency. Handling correctly numerical approximations - expected or not - is crucial to trust the results. It is usually not done in lightweight tools. It should. So I prove that if I could do it, OS manufacturers could as well.

168 comments

[ 2.4 ms ] story [ 230 ms ] thread
Unfortunately the link is unreadable on mobile due to the sidebar taking all the space.
Quickfix : I have added a button to hide the TOC. Not sure if it fits mobile screens anyway.
Body text remains at its original width when ToC is hidden, remaining unreadable at like 10% of screen width (with a lot of blank space).

Probably better quick fix: have ToC initialize as hidden on page load

> Windows Calculator almost does that: you can see the full input as you type, but it disappears upon hitting the final "=".

This has been rectified, by the way.

Even if it proves me wrong, it still makes me happy that some work is done on this tool. (I will fix the article)
This description is like a dissertation and history lesson in calculation, all in one. Add a comparison of `chalk` to the babbage difference engine, and it'll be 100% complete! :-P
Great work! I like how well considered the design is. This calculator takes a point in the design space with text input, equation rendering, a grapher, and Big Int/Floats for number representation.

I wonder if the author considered an input method where keypresses translate directly into a rendered equation? Symbolab kind of does this, so instead of writing an expression in some functional style and seeing its rendered output, I can directly manipulate the rendered equation with the keyboard.

The other point the author makes about discoverability of operators like sqrt and cbrt, I feel that you could circumvent it by introducing a semantic search feature for operators. For example, typing "square root" would display a list of suggestions for operators that match that, like an IDE.

The last question I have is if the author has looked at libraries like Calcium (https://fredrikj.net/calcium/) or the work that went into the Android calculator recently (https://dl.acm.org/doi/pdf/10.1145/3385412.3386037). They use exact arithmetic with computable real/complex numbers. It might serve as a cleaner abstraction that switching between different BigNum representations yourself.

Hi,

>I wonder if the author considered an input method where keypresses translate directly into a rendered equation?

Personally, I don't like such systems, because I always end up moving the cursor up/down/left/right trying to add parenthesis here and there; so I am not considering adding it. I really feel better with fast, raw text input.

>The other point the author makes about discoverability of operators like sqrt and cbrt, I feel that you could circumvent it by introducing a semantic search feature for operators.

Indeed, I can add this kind of things by adding keywords to the documentation items. Currently I rather tried to narrow the search results, but I can expand them a little with some experience on what the users really needed.

>The last question I have is if the author has looked at libraries like Calcium (...) or the work that went into the Android calculator recently

I don't know Calcium, and I am not a smartphone user, so Android is beyond my little world :-) Calcium seems very interesting on its own, but it is unlikely that I can use it in Chalk. I already built my own abstractions to do everything low-level related to bit manipulation and garbage bits. Adding a little formal calculus will certainly be home-made either. However, like I did with ARBLIB, I can also cherrypick just a subset of the library that would exactly fix one problem or give some precious help even on a single feature. I will have a deeper look at its API and how it can mix up with the current Chalk design. Thanks for pointing it out !

Being able to compute sin(0.1)/0.1 and reading the uncertainty at a magnitude of E-309 feels magical after doing everything in MATLAB, where the default float type only counts down to E-16. This is really cool!
You should try Emacs calc inside EXWM :D
> On a pocket calculator, you have one keyboard layout, and you simply ignore the keys you don't use. Has this ever been a problem?

Yes. There's a reason they sell basic stand-alone calculators, too, and it's not just price. There's a reason the ones for various tasks don't all look the same or have the same keys (a typical office desktop calculator is usually very basic, for instance). I'd bet money most calculators that exist are the fairly basic variety, not a fancy scientific calculator or whatever. Exclude the ones that were only ever used in school and never anywhere else and I bet it's an absolute landslide in favor of simple calculators. People are confused by the extra buttons, and don't want them.

[EDIT] Not to shit on this calculator, mind you, but this is another specialized one that won't be for everyone, not a universal solution.

We will somewhat disagree, partly because I can't help using calculators as a scientist, so my opinion is particularly biased. However, I don't like the trend to hide everything that looks technical. On the long run, letting people play with advanced features (that won't break things) is a win-win.
MacOS is really bad abut this sort of thing. It fails on discoverability. For instance, how do you navigate to a hidden folder in the file-selection dialog? There is no option to show hidden, and there is no place to input the exact path. You must know two things to proceed: That there is a secret hotkey to allow exact path specification, and what that hotkey is. It took me years to learn that there was a hotkey -- I just assumed that it was not possible.
Isn't the macos of 2022 just a very shiny thing to browse the web with, plus a linuxy terminal?

I always do file operations from the terminal if I can help it (won't save you when you need to select a file in a gui I suppose)

10+ years of owning macs, and Finder still bugs the hell out of me.

I find most of macOS reasonably well designed (at least compared to the competition), but Finder is truly awful. I highly recommend Forklift as Finder replacement.
Thanks for the Forklift recommendation. I've used Path Finder off and on for years, and it has some advantages over regular finder. But it doesn't seem to have enough differences, and their distinguishing features are not readily apparent. Path Finder also has features like upload to S3, but they put that under the menu (Commands -> upload to ).

Will definitely give Forklift a try.

> You must know two things to proceed: That there is a secret hotkey to allow exact path specification, and what that hotkey is. It took me years to learn that there was a hotkey -- I just assumed that it was not possible.

There's also menu item in the Finder menu - you know, that thing on the upper edge of the screen - Go | Go to folder... and it also gives away the secret hotkey.

There is no Finder menu in the upper edge when you are in the file-selection dialog of some random app.
It does fail on discoverability but there is a great feature of MacOS to compensate. The help->search function (shortcut key: Command-shift-/). I wish it was more prominent, like the quake console[1] or autocad command bar[2].

[1]Come to think of it, I used to have iTerm set up for this, I really must reconfigure it.

[2]https://knowledge.autodesk.com/support/autocad/learn-explore...

> MacOS is really bad abut this sort of thing. It fails on discoverability.

It's not just Macs. Just about everything in "modern" UIs fail discoverability.

You can set this permanently at the terminal with:

  defaults write -g AppleShowAllFiles yes
or to always see the hidden files in the Finder:

  defaults write com.apple.finder AppleShowAllFiles yes
use `defaults` to see and set a number of preferences that are not apparent. Around the turn of the century Mac OS started moving to streamline the UX and making it more difficult to change (and possibly break) things in that process; for better or worse. I remember the discoverability of user settings/preferences and tools/utilities being much easier using the finder and menu bars in the 90's. Now, one is forced to get comfortable with the command line to have that level of control and customization.
Thanks for these tips. I have often resorted to making symlinks to hidden folders (dotssh -> .ssh, dotconfig -> .config) because I don't feel like looking up the KB shortcut.

One additional note: after setting the defaults, if you want it to take place immediately, you need to kill finder.

    killall Finder
This seems like it’s not a “for everyone” calculator, and built in OS calculators are always going to go “simple desktop calculator” design as that’s what the vast majority of people want or need.

That said I just type equations into spotlight - it doesn’t handle user defined functions, graph results, or anything, but it has a reasonably full suite of the standard arithmetic functions and operators

You know what ? I was not even aware that it would work ! (Am I the only one to discover that just now ? I am not using Spotlight very often)

It's kind of cool, but I can still find many grievances about the way it's done :-)

I’m sure it’s not ideal, but for my purposes cmd-space (random math) is generally sufficient. But I’m also not a mathematician so I do maths with numbers and not letters :)
Even with numbers only, it can still be useful to know how wrong the result is. Chalk keeps track of every inaccuracy when dealing with decimal numbers.
Oh yeah, I very much use it as a super quick access calculator. If I was needing in a situation where I needed controlled error etc it wouldn’t necessarily be great, but that’s ok because in general if you have me working on something requiring that your project has other issues :)
(comment deleted)
Superb! I downloaded Chalk then did your donation button. Your calculator is excellent, and your write-up is so thorough that it works as a case study for UI/UX. Thank you.
My favourite desktop calculator so far is Qalculate![0] for similar reasons, and I basically never have the keypad shown. It uses libqalculate, which also provides an executable version that's usable on the console, which I also use often.

It's incredible and I love it.

[0] https://qalculate.github.io/

Thanks to Show HN I will be given tons of links to softwares I would never have found by myself :-)
This also has a nice command line interface for those who prefer the terminal.
(comment deleted)
I'm also using Qalculate! and never had an issue with it. Maybe I don't require complex enough calculations but whenever I want some quick basic math, it's a quick keybinding away and there's a history screen below the input screen so sometimes I don't even have to type anything to see the answer.
This is exceptionally cool. It feels like what would happen if one were to fastidiously reimagine the HP 48 user experience for the desktop (in terms of usage patterns, mental model, etc.).

I will 100% use this. However, you can take my HP 48GX when you pry it from my cold, dead hands. :-)

I also noticed that digit keys on keyboard in desktop calculators are useless - why would you type in numbers by clicking? It's very slow.
They're useful to some people for accessibility reasons.
As well as touch screens!

Accessibility-wise, it gives user choice between on-screen keyboard and the app native one

These days many devices can be used in touchscreen only mode (Microsoft surface etc), so keeping the digits makes even more sense there.

Looks very cool, congratulations! Have you tried Emacs Calc? Chalk reminds me of Emacs Calc, but without the symbolic computation (and without date calculations or anonymous functions).
I don't use Emacs, but I feel that people should just have access to a decent calculator without digging developer forums. As good as Emacs Calc is, we can admit that it's unlikely to be seen as an easy-to-find lightweight tool.
I'm not sure what you mean by "digging developer forums", but I fully agree with you that Emacs Calc is not a good choice for everyone, in fact, I would not recommend it to anyone that isn't already an Emacs user (but for people who are already Emacs users I do highly recommend it, since it has a ton of functionality and is an easy-to-find lightweight tool ---if you're already in Emacs anyway).

I was just curious to see if you had tried it, since it seems similar in spirit to your project, and thought you might be able to borrow some ideas from it.

I definitely agree with a lot of the complaints. I truly don't understand why so many computer calculator interfaces are so awful.

I've been using speedcrunch for a couple of years now and it scratches most of the itches for what I want out of a calculator. It looks fairly similar to Chalk's design as well. Very nice interface!

speedcrunch is simply underrated. ticks so many checkboxes
+1 for SpeedCrunch

For anything more complex there is SageMath and Jupyter notebook.

Another + for speedcrunch, a tool I didn't know I needed until I discovered it.
Interesting but I notice that the Emacs calculator (calc.el) isn't in the comparison. It is what I use for quick calculations most of the time. There was also a Mac program called Milo a long time ago that was very cool. I never had a chance to study it though.
I second the usefulness of the calculator built into Emacs. Even if I didn't use Emacs for anything else, I'd keep an alias around for starting calc.
I agree, but as good as it is, this is not where people would like to find a good calculator.
(comment deleted)
How is an OS not a good place to find a calculator?
Why not? Is the overhead of Emacs around the calculator too much on a modern desktop computer? Emacs apps are far leaner than the many Electron apps people seem to not have a practical problem with.
I still enjoy using a good handheld calculator. Today it's an HP 35s which is fine but I only bought it because my HP-28s battery door broke.

I'd love to get one of the Swiss Micros[1] but I can't really justify it when my 35s is good enough. Maybe if I get a nice bonus this year I'll treat myself.

[1]: https://www.swissmicros.com/products

I still use the python repl in a terminal for my desktop calculator. Its a good choice since usually im already in the terminal anyways.
I also do the same although when I need fractions, having to type all the words to import and use the fraction module is a pain
Why not just save those words, and other commonly used words to a startup file? Then, you can just do

    export PYTHONSTARTUP=/home/savant_penguin/.python/startup.py
and those things will be automatically loaded for you. (Edit: add that line to your .bashrc if you want to use it all or most of the time!)

If you don't want them always loaded, but rather just for a "calculator mode," you can do something like

    alias pycalc='PYTHONSTARTUP=/home/savant_penguin/.python/ipython startup_calc_mode.py'
If you use ipython, then you can take advantage of autocomplete and not have to type as much, too.
Thank you for this!!! I use the repl all the time and had no idea I could do this.
You're quite welcome. After 7+ years of using Python professionally, I find I'm still discovering things I didn't know. And, I'm not referring to just new stuff that gets added, either. It's cool to pick up on these little things every once in a while.
This is a really nice idea.

Together with some from fractions import Fraction as F would be even better

Thanks

I've been using clisp in the terminal since, well, forever. There's probably no advantage over Python, though.
I got fed up with all these complicated calculators and re-implemented the original Mac calculator desk accessory at https://CalculatorDA.com. It does the simple things I need while giving me a nice nostalgia buzz.
I have been carrying around a copy of the Windows XP calculator ever since Microsoft decided that nobody can do both decimal values and decimal <-> hex <-> binary conversion without having to go through a menu to change modes. With the XP calculator, I use F5-F8 as shortcut keys for changing bases whenever I want. The Windows 10 calculator doesn't even do anything with those keys in scientific mode.
I'm surprised no one has mentioned Soulver yet (https://soulver.app/). I have used it for years -- it looks like it has pretty similar functionality to this but (IMO) with a more native-feeling UI. I love it.

I don't think it supports as wide a range of math, but it does seem to pass the accuracy test given in the article (sin(exp(37))). It also lets you assign variables which I find handy.

On the other hand, the propagation of uncertainty in Chalk is very cool.

I haven't seen Soulver, but it looks very similiar to the one I use on Mac, called Numi. On Android, I use an app called CalcNote which works in a similiar way. Neither does graphing, but you can do common formulas and functions like cos/sin/rad. I use numi for simple calculations, and find it fantastic when I'm trying to figure out project stuff. A recent use is entering wall dimensions to figure out square footage and compare different building materials. I often leave most of my old calculations in numi like a long-lived numerical memory.

https://numi.app/

https://play.google.com/store/apps/details?id=com.burton999....

Thanks for the Android app recommendation, it's amazing! Basically numi on Android, love it!
There's been a lot of suggestions for alternative desktop calculator programs that try to remedy some of the issues outlined. I've had similar experiences/annoyances with calculator apps, most of which to copy handheld calculators but without the satisfaction of buttons yet the power of a programming repl/solver.

I've currently settled on MathLab's Graphing Calculator[0] which has very similar design elements for any larger scale calculations. My second choice if the calculation requires estimates or units is obviously Wolfram Alpha, but the need for connectivity, lack of calculation history and speed leaves it lacking as a quick calculation tool.

[0]: https://play.google.com/store/apps/details?id=us.mathlab.and...

Lots of cool functionality in Chalk. I love it.

The main thing I use Google search calculator for is natural-language unit conversions like "2 gigabytes / 128 kibibits per second in days" which is not in scope for Chalk, but there's a nice desktop calculator called Soulver that is good at that kind of thing.