[olug] Doing math in /bin/bash
Kevin D. Snodgrass
kdsnodgrass at yahoo.com
Sat May 7 15:16:41 UTC 2011
--- On Sat, 5/7/11, Chad Homan <choman at gmail.com> wrote:
> but on your gcalctool example, try quoting the equation
>
> COUNT=`gcalctool -s "($a *$b) / $c"`
That was the easy part. I needed to do a more complex calculation, maintaining precision until the final assignment to a shell variable as an integer value. I.e., complex math with real numbers and maintaining real number precision, but where the final number must be integer only, no decimal.
After thinking about it some more, I might be able to simplify the equations anyhow. That might make this all a non issue... (Dang, haven't had ALGEBRA in, what, 32 years? Why do I remember vector calculus and diff eq but can't remember ALGEBRA?! :-P )
Kevin D. Snodgrass
More information about the OLUG
mailing list