Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I used to use this back when I mained Windows. Ever since moving primarily to Linux, and getting familiar with Emacs, Calc mode simply beats every calculator I've ever used in total functionality. However, there are certain cases where I also like to use https://insect.sh if lots of units are involved.


Emacs Calc (not unlike much of the rest of Emacs) is a little ... special. By default, it calculates 4/2*2 as 1, because multiplication has a higher precedence than division.

https://orgmode.org/manual/Formula-syntax-for-Calc.html


> because multiplication has a higher precedence than division

Wow. That's actually quite bad.


I think some people learned P-E-MD-AS as if MD and AS didn't have the same precedence. I mean, it's a convention anyway, so they aren't really "wrong" insomuch as just being unusual. But it does seem like an odd thing to disagree about.

I think there's also some confusion about whether the / symbol is actually being used as a single line equivalent to a fraction, which might introduce some ambiguity? I forget. The number of ways that people can misunderstand things is infinite, so it can be hard to keep track.

Anyway, parentheses are cheap and misunderstandings, even when the other party ought to take the blame, can be expensive, so I've taken up the habit of being generous with the things.


I've used Emacs Calc for >5 years and never knew about this, because I always do calculations in RPN.


You could open an issue. Seems like a reasonable idea to fix that.


Making it the opposite is wrong as well, though (PEMDAS or whatever the acronym americans learn isn't the sole truth). Just use parenthesis.


It's by design. The option calc-multiplication-has-precedence controls this behavior.


You may like qalc. It's an apt-get away and does all those units.


I love you.


This may be slightly off topic, but what are some other small, lesser known websites like this one that people use regularly? For me, it'd be https://rubular.com and https://crontab.guru. I've used those 2 sites pretty regularly across my entire career.


Well, I run Insect locally. The page is just for demo purposes. You just install it from NPM.


qalculate is by far the best calculator program I've ever used.


I've been using and loving qalculate for years as part of Debian but strangely it isn't in the current Debian stable package list (bullseye). So I just switched to SpeedCrunch and it seems like a good replacement for most quick calculations where you still want to see some history.


Agreed. This is one case that's not hyperbole.


Google used to be excellent with units. My test is always `15 mpg in l/100km`, and Google & wolfram alpha were/are the only ones to get it right.

(Just tried, and it works again in Google, after not working for a few years)

edit: Spotlight now has it as well. Congratulations to Apple & I need to move the goalpost.


insect.sh is so cool!

``` (6 Mbit / s) × 1.5 h GB = 4.05 GB ```

Love that. Thanks the recommendation.


I use calc as well, especially practical in combination with guake ( a drop-down quake style console: https://github.com/Guake/guake ).


I'm using Emacs in a floating window under I3wm that I can toggle into the scrap buffer and back with a key binding. Doing the same with one terminal. This inspiration for this also came from the console in Quake.


Is there a way to start Emacs in full window calc mode?


If I remember right:

  emacs -f full-calc


Awesome, thank you!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: