DEV Community

Do You Use Calculators or Programs?

MetaDave 🇪🇺 on April 18, 2018

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...
Collapse
 
andy profile image
Andy Zhao (he/him) • Edited

I use Alfred (a Spotlight search replacement on MacOS) for my calculator:
short gif showing Alfred's calculator functions

Here are the steps I took in the gif:

  1. Open Alfred with cmd + space.
  2. Input 5 + 5, which then shows me the result 10 in the "search results".
  3. Input an additional divide by 2 / 2, which gives me 7.5 (because PEMDAS).
  4. Delete the divide by 2, and hit the equal key = to change my input to the result 10.
  5. Divide 10 by 2 / 2 to get my new result of 5.
  6. Multiply by 5 * 5 to get 25.
  7. Hit enter to copy the result of 25 to my clipboard.
  8. Paste 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. :)

Collapse
 
databasesponge profile image
MetaDave 🇪🇺

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.

Collapse
 
andy profile image
Andy Zhao (he/him)

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.

Thread Thread
 
philnash profile image
Phil Nash

I do maths in Alfred and string operations in irb. So much easier than anything else I can think of!

Collapse
 
nektro profile image
Meghan (she/her) • Edited

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/

Collapse
 
dmfay profile image
Dian Fay • Edited

I use a zsh plugin which aliases = to a calculator right in the shell.

Collapse
 
databasesponge profile image
MetaDave 🇪🇺

This is very convenient. Hadn't thought that there might be a shell solution for this.

Collapse
 
val_baca profile image
Valentin Baca

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:

$ python3
>>> 0.1 + 0.2
0.30000000000000004

Our base-10 system isn't without problems (i.e. 1/3), but obviously we're all much more familiar with them.

Collapse
 
lambdude profile image
Ian Johnson

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.

Collapse
 
databasesponge profile image
MetaDave 🇪🇺

Racket, eh? That's a new one for me. I shall investigate.

Collapse
 
lambdude profile image
Ian Johnson • Edited

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.

Racket Example

Thread Thread
 
databasesponge profile image
MetaDave 🇪🇺

That's really smart-looking stuff. I'll give it a go.

thanks.

Collapse
 
rhymes profile image
rhymes

I do the same, it's either irb or python or even just bc

Collapse
 
andy profile image
Andy Zhao (he/him) • Edited

I learned about bc like yesterday. Blew my mind that it existed. Then again, why wouldn't it? 🤔

Collapse
 
databasesponge profile image
MetaDave 🇪🇺

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!

Collapse
 
cess11 profile image
PNS11

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

Collapse
 
scottishross profile image
Ross Henderson

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.

Collapse
 
databasesponge profile image
MetaDave 🇪🇺

SQL Dev as-in Oracle SQL Developer?

Collapse
 
scottishross profile image
Ross Henderson • Edited

Yeah. It's not as easy in retrospect.
select (32 * 123) / 4 from dual

Thread Thread
 
databasesponge profile image
MetaDave 🇪🇺

No stupid ANSI maths though. That's a plus.

Collapse
 
rosejcday profile image
Rose Day

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.

Collapse
 
databasesponge profile image
MetaDave 🇪🇺

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! :)

Collapse
 
rosejcday profile image
Rose Day

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.

Collapse
 
jessefulton profile image
Jesse Fulton • Edited

I just discovered Numi the other week - it's a surprisingly nice calculator app for OSX.