Re: Simple calculator
Michael Meskes writes:
> On Thu, Aug 06, 1998 at 11:01:06AM -0700, David Welton wrote:
>> > That one´s really nice. However, bc cannot do sin(1), can it?
>> bc seems to actually work if you use it with -l:
>> MATH LIBRARY
>> If bc is invoked with the -l option, a math library is
>> preloaded and the default scale is set to 20. The math
>> functions will calculate their results to the scale set at
>> lowing functions:
>> s (x) The sine of x, x is in radians.
>> the time of their call. The math library defines the fol
> Okay, you got me. I'm not interested in packaging calc anymore. I will
> use that function.
Maybe we could convince the bc maintainer to add a shell script to the
bc package (call it "calc" or something else easy to remember) which
does command-line calculations, then; it seems as though a lot of people
would find such a thing useful.
if [ $# = 0 ]; then
echo "`basename $0`: must supply something to calculate!" >&2
echo "$*" | bc -l | sed 's/0*$//'
Neale Pickett, propellerhead Contact information in headers
Los Alamos National Laboratory, Network Engineering Group (CIC-5)
To UNSUBSCRIBE, email to email@example.com
with a subject of "unsubscribe". Trouble? Contact firstname.lastname@example.org