# What calculator app do you use?



## aragon (Jul 13, 2009)

Hi,

This might seem like a strange question, but I was wondering what calculator app people are using?  I normally use gCalcTool, but getting annoyed at all the needless dependencies it requires.  Looking for something liter that's as functional!

GUI preferred, but an easy to remember CLI app will make me happy too. 

(python, perl, and PHP are not what I consider to be easy to remember calculator apps)


----------



## DutchDaemon (Jul 13, 2009)

x11/xcalc

Alll it needs is

```
/usr/ports/devel/pkg-config
/usr/ports/x11-toolkits/libXaw
/usr/ports/x11-toolkits/libXtp
```


----------



## graudeejs (Jul 13, 2009)

math/scilab


----------



## ephemera (Jul 13, 2009)

ports/math/speedcrunch

(I am also impressed with the code: very clean & well written)


----------



## dh (Jul 13, 2009)

I use either bc or ipython shell for more complex stuff


----------



## rbelk (Jul 13, 2009)

All I use is bc or /usr/ports/math/add, love the CLI!


----------



## tingo (Jul 17, 2009)

I use xcalc for gui needs.


----------



## drhowarddrfine (Jul 17, 2009)

killasmurf86 said:
			
		

> math/scilab



Marked as broken and has no maintainer.

I also use xcalc and bc.


----------



## hydra (Jul 18, 2009)

I use bc.


----------



## vermaden (Jul 19, 2009)

xcalc, galculator or ... google.com


----------



## aragon (Jul 19, 2009)

Thank you all for your input.  After looking at all of them, galculator was exactly what I was after.


----------



## Beastie (Jul 19, 2009)

vermaden said:
			
		

> xcalc, galculator or ... google.com


Exactly like vermaden. Galculator (mostly) and Xcalc.


----------



## bb (Jul 19, 2009)

It really depends on your focus.

Some programs I've used: bc -l, pari, R, gnuplot, teTeX


----------



## mwatkins (Jul 19, 2009)

xcalc but usually Python as I almost always have a python interpreter running. With readline support turned on, a simple press of the tab key will expand what you are working on.

What could be simpler than:


```
[font="Courier New"]$ python
Python 2.6.2 (r262:71600, Jun 30 2009, 09:33:04) 
[GCC 4.2.1 20070719  [FreeBSD]] on freebsd7
Type "help", "copyright", "credits" or "license" for more information.
>>> 2 + 3
5
>>> 33/2
16
>>> # note with and without parenthesis
>>> (2+3)/2
2
>>> 2+3/2
3
>>> # need more? Import math
>>> import math
>>> # showing readline provided tab expansion:
>>> math.
             acos         atan2        cosh         factorial    hypot        log10        radians      tanh         
__doc__      acosh        atanh        degrees      floor        isinf        log1p        sin          trunc        
__file__     asin         ceil         e            fmod         isnan        modf         sinh         
__name__     asinh        copysign     exp          frexp        ldexp        pi           sqrt         
__package__  atan         cos          fabs         fsum         log          pow          tan[/font]
```

Need even more? There are some heavy duty scientific computing libraries for Python. Can't remember how to use a function?


```
[font="Courier New"]>>> help(math.factorial)
Help on built-in function factorial in module math:

factorial(...)
    factorial(x) -> Integral
>>> math.factorial(14)
87178291200L[/font]
```
 
The interactive shell is a very useful tool.


----------



## CmdLnKid (Jul 20, 2009)

Any sh "Bourne style shell" will do some math.

Some allow $[1+1] while others make it mandatory to use $((1+2)) preferably.

dc is also fairly complicated and nice. echo '[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq'|dc

Just joking.


----------



## kano (Jul 20, 2009)

Either python or my iphone if i'm not near a computer.


----------



## DutchDaemon (Jul 20, 2009)

```
>>> 33/2
16
>>> (2+3)/2
2
>>> 2+3/2
3
```

Sure, nothing could be simpler, but I think people expect more accuracy from a calculator


----------



## lm8 (Jul 20, 2009)

If there are any other SciTE (programming editor) users, you can get a calculator running fairly quickly just by adding a Lua script.  The Lua code for a nice text drawn calculator is available here along with other calculator examples:
http://lua-users.org/wiki/SciteScripts
See the SciteCalculator link.  It's not the same a separate calculator program, but nice for a quick calculation like when I want to convert between hex and decimal.


----------



## mwatkins (Jul 21, 2009)

DutchDaemon said:
			
		

> Sure, nothing could be simpler, but I think people expect more accuracy from a calculator



:\

LOL. Clearly I did not even look at the result - this is a left over of Python pre 3.x. In 2.x and earlier, Python's division operator behaves like the C division operator when presented 2 integer arguments.

I've been transitioning away from Python 2.x to Python 3 and in Python 3 real division instead of "floor" division is the default in Python 3.


```
Python 3.1
[GCC 4.2.1 20070719  [FreeBSD]] on freebsd7
Type "help", "copyright", "credits" or "license" for more information.
>>> 33/2
16.5
>>> (2+3)/2
2.5
>>> 2+3/2
3.5
```

My system python is 2.6 however and I'd not noticed that I was in a 2.x interpreter. 2.x can do real division instead of floor operations but requires an import to get the "new" behaviour:


```
Python 2.6.2 (r262:71600, Jun 30 2009, 09:33:04) 
[GCC 4.2.1 20070719  [FreeBSD]] on freebsd7
Type "help", "copyright", "credits" or "license" for more information.
>>> 33/2
16
>>> (2+3)/2
2
>>> 2+3/2
3
[B]>>> from __future__ import division[/B]
>>> 33/2
16.5
>>> (2+3)/2
2.5
>>> 2+3/2
3.5
>>>
```

Still simple, but simpler in Python 3.


----------



## Ghirai (Jul 21, 2009)

You can get away w/o the future import by typing one of the operands as a float:


```
Python 2.6.2 (r262:71600, Jul 18 2009, 00:10:51) 
[GCC 4.2.1 20070719  [FreeBSD]] on freebsd7
Type "help", "copyright", "credits" or "license" for more information.
>>> 33/2.0
16.5
```


----------



## DrJ (Jul 22, 2009)

To be a bit of a contrarian (who, me??), most often I still use a real calculator when I need one (I've an HP 32S II).  If the calculation is more than I can easily do on that, I use a spreadsheet.  More complicated yet?  Write a program.

I do use the Gnome calculator and galculator once in a blue moon, but I prefer the real buttons of a real calculator.


----------



## graudeejs (Jul 22, 2009)

I still prefer scilab....
It allows to do vector math very easy....

Also I forgot to mention, that I use mathomatic.... It's not calculator, but it helps with formulas a lot


----------



## vivek (Jul 22, 2009)

I use bc -l :e


----------



## Carpetsmoker (Jul 23, 2009)

dc(1)

Comes with base, and has postfix notation.

On Windows, I use python.

I actually prefer ``real'' calculators but most sucks because they don't execute commands in the right order (i.e. 5+5*5=50, not 30) so I never use them. Getting a postfix calculator is on the TODO list ...



			
				DutchDaemon said:
			
		

> ```
> >>> 33/2
> 16
> >>> (2+3)/2
> ...



That's because you gave python integers, so it will return integers.
Force floats by using _n.0_ for one of the numbers, for example:


```
>>> 33.0 / 2
16.5
>>> (2 + 3.0) / 2
2.5
>>> 2 + 3 / 2.0
3.5
```


----------



## DrJ (Jul 23, 2009)

Carpetsmoker said:
			
		

> Getting a postfix calculator is on the TODO list ...



Get an HP scientific one with RPN (Reverse Polish Notation).  There's no equals sign, and it is wonderful once you get used to it.  I assume they are still made...


----------



## DrJ (Jul 23, 2009)

CS, look at this one: http://www.shopping.hp.com/product/calculator/Scientific/1/storefronts/F2215AA%23ABA

It is a straight-forward scientific calculator, and it looks like a good one.


----------



## Carpetsmoker (Jul 23, 2009)

HP calculators are nice, but are expensive, even secondhand.

EDIT: Posted at the same time as you DrJ, will look at that one.

By the way, you know you (indirectly) introduced me to RPN? You made a thread about RPN calculators on DF some time ago, which got me curious, I tried it and been loving it ever since I got used to it.


----------



## fronclynne (Jul 23, 2009)

Carpetsmoker said:
			
		

> 5+5*5=50, not 30



I'm curious.  Do you mean good calculators DO or DO NOT violate the order of operations?

xcalc(1), for example, produces "30" when I punch, "5 + 5 * 5 =" which is correct.


----------



## Carpetsmoker (Jul 23, 2009)

fronclynne said:
			
		

> I'm curious.  Do you mean good calculators DO or DO NOT violate the order of operations?
> 
> xcalc(1), for example, produces "30" when I punch, "5 + 5 * 5 =" which is correct.



Any good calculators *should* respect proper order of operations.

Windows calc for example does not, neither do most cheaper ``real'' calculators, we have 10 orso different ones at work and I tried them all 

And yes, xcalc does it correctly. I dislike xcalc for other reasons though.



> CS, look at this one: http://www.shopping.hp.com/product/c...2215AA%23ABA
> 
> It is a straight-forward scientific calculator, and it looks like a good one.



That one looks nice, although it's quite a bit more expensive in the Netherlands because of VAT and stuff, in total about 85USD excl. shipping...


----------



## DrJ (Jul 23, 2009)

Carpetsmoker said:
			
		

> By the way, you know you (indirectly) introduced me to RPN? You made a thread about RPN calculators on DF some time ago, which got me curious, I tried it and been loving it ever since I got used to it.



Really?  I had no idea.  For me there was never any getting used to them: I've used them since their first HP 45 offering when I was in High School (when dinosaurs roamed the earth).


----------



## DrJ (Jul 23, 2009)

Carpetsmoker said:
			
		

> That one looks nice, although it's quite a bit more expensive in the Netherlands because of VAT and stuff, in total about 85USD excl. shipping...



If you use it fairly regularly, I think it is well worth it.  Good tools always are.  OTOH, if it is something you use once every couple of weeks or once a month, then probably not.  

You should keep in mind that good calculators last forever.  I bought an HP 25C as an undergrad, and this one in the early 1980s (*I think*).  Other than replacing the batteries once, it is still going strong.


----------



## J65nko (Jul 23, 2009)

When I have to deal with large numbers, like calculating the partion sizes of the insane large disks which are common nowadays, I use a shell script and two perl scripts to commify or periodify the output of bc(1). 

See http://www.daemonforums.org/showthread.php?t=2899


----------



## SirDice (Jul 24, 2009)

fronclynne said:
			
		

> xcalc(1), for example, produces "30" when I punch, "5 + 5 * 5 =" which is correct.


Actually, it isn't. Mathematical precedence dictates that multiplication goes before addition. 50 would be the mathematically correct answer to 5+5*5.

http://en.wikipedia.org/wiki/Order_of_operations

I do agree about the physical calculators, I still have my HP-32S and I still love RPN.


----------



## DutchDaemon (Jul 24, 2009)

SirDice said:
			
		

> Actually, it isn't. Mathematical precedence dictates that multiplication goes before addition. 50 would be the mathematically correct answer to 5+5*5.



:q 

Multiplication before addition means 5+5*5 = 5+(5*5) = 5+25 = 30 ..

Mister Van Dalen awaits a reply!


----------



## SirDice (Jul 24, 2009)

< needs his HP :r

Why did I think 5*5 = 45?!? x(


----------



## DutchDaemon (Jul 24, 2009)

But it is. For very large values of 5.


----------



## SirDice (Jul 24, 2009)

DutchDaemon said:
			
		

> But it is. For very large values of 5.


LOL

Must be the meds kicking in again :\


----------



## Carpetsmoker (Jul 30, 2009)

I ordered the 35s today.

Nice review with some nice comments too:
http://www.stefanv.com/calculators/hp35s.html



			
				DrJ said:
			
		

> If you use it fairly regularly, I think it is well worth it.  Good tools always are.  OTOH, if it is something you use once every couple of weeks or once a month, then probably not.



True.
It's not something I use every day, but when I do use it, I always find myself cursing at those infernal dysfunctional contraptions and wishing for a better one ...

It turned out I could order one from my work, which is somewhat cheaper.


----------



## MG (Jul 30, 2009)

perl -e "print 1+1"


----------



## DrJ (Jul 30, 2009)

Carpetsmoker said:
			
		

> I ordered the 35s today.
> 
> Nice review with some nice comments too:
> http://www.stefanv.com/calculators/hp35s.html



Please let me know how you like it.  According to your cited review, the one I use is something of a classic (and I do like it a great deal) but it will die one of these days.  The one you bought looks like the most suitable replacement.


----------



## DrJ (Jul 30, 2009)

Generally along the topic of this thread, don't forget about the Unix utility "units."  It does unit conversions, though only between those that use ratios (so no Celcius to Fahrenheit conversions).  I always forget some conversions, like various energy units, and some prefixes, like atto, nano, pico and femto, which I work with very often.


----------



## morbit (Aug 5, 2009)

DutchDaemon said:
			
		

> x11/xcalc
> 
> Alll it needs is
> 
> ...



Yet without xbitmaps it will moan, and without font-adobe-* it will moan and will not display square root symbol..

But I'm using it too.


----------



## mirco (Sep 11, 2015)

vermaden said:


> xcalc, galculator


I like the paper mode of math/galculator.


----------



## Oko (Sep 11, 2015)

fronclynne said:


> I'm curious.  Do you mean good calculators DO or DO NOT violate the order of operations?
> 
> xcalc(1), for example, produces "30" when I punch, "5 + 5 * 5 =" which is correct.


That problem in mathematics was solved 100 years ago. Normal people use stack-oriented programming languages which in turn use correct reverse Polish notation. Parentheses and "operation priorities" are invented by people like me who make living by occasionally teaching "math" to the weak college students.


----------



## fernandel (Sep 11, 2015)

On my Android phone I have installed and I am using HP 48G. The name of the free version is go48g. It woks very good.


----------



## storvi_net (Sep 11, 2015)

Carpetsmoker said:


> Any good calculators *should* respect proper order of operations.
> 
> Windows calc for example does not, neither do most cheaper ``real'' calculators, we have 10 orso different ones at work and I tried them all



Just to be fair: The "standard view" of Windows calc does not respect the proper order. The "scientific" (I don't know it's called in english version) does respect the proper order.

Regards
Markus


----------



## wblock@ (Sep 11, 2015)

math/galculator has a usable RPN mode.


----------



## jrm@ (Sep 11, 2015)

Emacs users have a few options within Emacs itself.  

You can simply evaluate lisp expressions like `(+ 5 (* 5 5))`.
Use calc, which uses RPN and is sometimes referred to as the poor man's Mathematica because it can do some symbolic math,  has arbitrary precision, and (a subset of) other goodies found in more complex packages.
ESS makes using the math/R statistical package inside Emacs powerful.


----------

