I have just realised that I can no longer be bothered to find the calculator program on my Macbook, and instead just open an Interactive Ruby Shell (a.k.a. irb
) to do my arithmetic.
I'm wondering if this is a common (dys)function, and does it vary by the language you use?
Are there, for instance, JS programmers out there who will just do a bit of casual arithmetic in their browser console?
Top comments (24)
I use Alfred (a Spotlight search replacement on MacOS) for my calculator:
Here are the steps I took in the gif:
cmd + space
.5 + 5
, which then shows me the result10
in the "search results"./ 2
, which gives me 7.5 (because PEMDAS).=
to change my input to the result10
./ 2
to get my new result of5
.* 5
to get25
.25
to my clipboard.25
to show that I copied it.This is one of my favorite features of Alfred, especially how intuitive using it feels. I rarely have super lengthy math calculations. If I do need to keep track of everything, I end up using
pry
(another Ruby REPL) because I like the colors. :)This is great. I guess I should look a bit further into what alfred does, but if it just does my sums that's good enough.
Alfred is amazing. I personally don't use it too intensively and definitely use the calculator the most out of all its features. I love that it has all sorts of features, even though I don't use a lot of them.
I do maths in Alfred and string operations in
irb
. So much easier than anything else I can think of!For me, for most everyday math I use either google (Command+0 mapped to "new chrome tab") or the mac calculator (command+space for Spotlight, type "calc").
For larger personal math stuff, like my budget, I use Google Sheets.
I stay away from using REPL for math for the known issues that come with
float
handling decimals:Our base-10 system isn't without problems (i.e. 1/3), but obviously we're all much more familiar with them.
I still use the Windows Calculator for simple things. Since Windows search has been really good for me, all I have to do to get to it is hit the Windows key then type "cal" and it's right there. For more complicated math I'll use a website.
web2.0calc.com/
desmos.com/calculator
Shameless plug: I also use apps.nektro.net/calculator/
I use a zsh plugin which aliases
=
to a calculator right in the shell.This is very convenient. Hadn't thought that there might be a shell solution for this.
I use Racket to do this also. The nice thing about this is that I can define functions on the fly in lisp-style. I've used irb for this before, but now I use Racket because it has better representations for rational numbers and it's ease of function declaration, thanks to the fact that it is a lisp.
Racket, eh? That's a new one for me. I shall investigate.
Here are some examples. There's a lot more that it can do, but that's a bigger topic. Also, you have to get used to the polish notation.
That's really smart-looking stuff. I'll give it a go.
thanks.
Until recently I used CLISP for this purpose, it is slightly easier to do casual arithmetic in it than the fixnum only paradigm in picolisp, and it loads slightly faster than SBCL.
However, stack languages are even better for quickly expressing everyday math, so once I got Factor compiled and running on my boxes it has replaced CLISP as my go-to language for doing calculator stuff.
factorcode.org
I do the same, it's either irb or python or even just bc
I learned about
bc
like yesterday. Blew my mind that it existed. Then again, why wouldn't it? 🤔Oh wow, the old bench calculator. I think I used to use that back in the 80s/90s, when my life was terminal-only HP-UX/AIX. I'm going to revisit that. Cheers!
Depends what I'm currently using at the time. If I'm on Brackets, I'll use the Calc. If I'm in SQL Dev I'll do the calculation on that.
SQL Dev as-in Oracle SQL Developer?
Yeah. It's not as easy in retrospect.
select (32 * 123) / 4 from dual
No stupid ANSI maths though. That's a plus.
I usually use Matlab because it's still downloaded on my computer and it's easy to use for most things I need to calculate.
That seems like a sledgehammer-to-crack-a-nut to me, but I think if there's a lesson in here it's that arithmetic is just a commodity, and people use whatever tool is convenient/familiar to solve it.
At least you have a scalable solution there though! :)
Ha, it really is like a sledgehammer for most problems! I have it because I used it a lot in my undergrad for class work and projects so mine as well use it every now and again.
I just discovered Numi the other week - it's a surprisingly nice calculator app for OSX.