Re: [opensuse] Command line calculator?



-----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@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx



Relevant Pages

  • Re: [opensuse] Command line calculator?
    ... echo $) ... at CLI ... of course if you want trig and logs you need do a little work... ... Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org ...
    (SuSE)
  • Re: Graphical Ray tracing on Hangar Floor
    ... mechanical desk calculator. ... calculator like a Marchant or a Frieden. ... Square roots we performed ... In 1947, or before, smart lens designers in England had discarded trig ...
    (sci.optics)
  • Re: cnc lathe programming question
    ... it's a whole lot quicker to make a sketch and trig ... something out than it is to go fire up a computer just to draw some ... Do it once & program your calculator if need be. ...
    (alt.machines.cnc)
  • Re: cnc lathe programming question
    ... it's a whole lot quicker to make a sketch and trig ... something out than it is to go fire up a computer just to draw some ... Do it once & program your calculator if need be. ... so this must be a later calculator ormy memory of he number of needed ...
    (alt.machines.cnc)
  • Re: How to measure an angle?
    ... >> ABC is the arccossine of the dot product, ... >> with a computer or calculator. ... will have to evaluate an inverse trig function." ...
    (sci.math)