[opensuse] Command line calculator?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Does anyone know if there is a program for a command line calculator, and if so what it is called? -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFGhWGYzZAvb+u/9+oRAkPXAKDg7DOBwipqfMo+82TAz4eSn5eRLwCghaT2 mnPrt9oqzOhrS2bhoUgpFAU= =//RH -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Does anyone know if there is a program for a command line calculator, and if so what it is called?
If you want to use it in a script, check out "expr". Otherwise, check out "bc". - BS -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Adam Jimerson wrote:
Does anyone know if there is a program for a command line calculator, and if so what it is called?
bash :-) try echo $((5+2)) echo $((7*6)) at CLI of course if you want trig and logs you need do a little work... - -- ============================================================================== I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone. Bjarne Stroustrup ============================================================================== -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFGhWRnasN0sSnLmgIRAsffAKCzdwgx+9L8bPkBgqwnyqZgS5I6FgCfeueH cCyrSevH32TMBT6HvXYJVRQ= =N3Sw -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Friday 29 June 2007 12:58, G T Smith wrote:
Adam Jimerson wrote:
Does anyone know if there is a program for a command line calculator, and if so what it is called?
bash :-)
try
echo $((5+2)) echo $((7*6))
Or, try these: % echo $(( 5.5 + 2.2 )) bash: 5.5 + 2.2: syntax error in expression (error token is ".5 + 2.2 ") % echo $(( 010 * 020 )) 128 % echo $(( 080 + 020 )) bash: 080: value too great for base (error token is "080") % echo $(( 0xa * 0xa )) 100
at CLI
of course if you want trig and logs you need do a little work...
It only does integers and has an inflexible way of treating numeric radixes (e.g., leading zero forces octal), as shown above. Dc (RPN) or bc (infix) are the way to go for non-trivial scripted calculation. They do floating point, arbitrary precision and have formatted printing. (BASH has this, too, perhaps even better, being modelled after the C library printf() function.) Randall Schulz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I guess I should have stated that I just need it to be simple... If I needed something that could do trig and all that I would pull out my TI-84 Plus. I just need it for pure convince, and I bc would do. Thanks for the help and the suggestions. Adam Randall R Schulz wrote:
On Friday 29 June 2007 12:58, G T Smith wrote:
Adam Jimerson wrote:
Does anyone know if there is a program for a command line calculator, and if so what it is called? bash :-)
try
echo $((5+2)) echo $((7*6))
Or, try these:
% echo $(( 5.5 + 2.2 )) bash: 5.5 + 2.2: syntax error in expression (error token is ".5 + 2.2 ")
% echo $(( 010 * 020 )) 128
% echo $(( 080 + 020 )) bash: 080: value too great for base (error token is "080")
% echo $(( 0xa * 0xa )) 100
at CLI
of course if you want trig and logs you need do a little work...
It only does integers and has an inflexible way of treating numeric radixes (e.g., leading zero forces octal), as shown above.
Dc (RPN) or bc (infix) are the way to go for non-trivial scripted calculation. They do floating point, arbitrary precision and have formatted printing. (BASH has this, too, perhaps even better, being modelled after the C library printf() function.)
Randall Schulz -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org
iD8DBQFGhbuwzZAvb+u/9+oRAmoRAKCz53wRJwQ2DpfeCke13nApHLeI7ACg5HdF RIVndIcY74r1PZCAVBay4cI= =HbwW -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
* Adam Jimerson
Does anyone know if there is a program for a command line calculator, and if so what it is called?
Name : calc Relocations: (not relocatable) Version : 2.12.1.8 Vendor: (none) Release : 0 Build Date: Tue 06 Feb 2007 08:47:59 PM EST Install Date: Wed 07 Feb 2007 09:03:42 AM EST Build Host: emma.isthe.com Group : Applications/Engineering Source RPM: calc-2.12.1.8-0.src.rpm Size : 3930439 License: LGPL Signature : (none) URL : http://www.isthe.com/chongo/tech/comp/calc/index.html Summary : Arbitrary precision calculator. Description : Calc is arbitrary precision C-like arithmetic system that is a calculator, an algorithm prototype and mathematical research tool. Calc comes with a rich set of builtin mathematical and programmatic functions. For the latest calc release, see the calc project home page: http://www.isthe.com/chongo/tech/comp/calc/index.html - -- Patrick Shanahan Plainfield, Indiana, USA HOG # US1244711 http://wahoo.no-ip.org Photo Album: http://wahoo.no-ip.org/gallery2 Registered Linux User #207535 @ http://counter.li.org -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQFGhWjHsbn4NKpz0QERAkouAJwPoygbkWPKaHYkVL2ar4v65SAFUwCgyETU bhlVzu40ll/04w1ZriGh4MU= =kYby -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (5)
-
Adam Jimerson
-
Bruce Smith
-
G T Smith
-
Patrick Shanahan
-
Randall R Schulz