bc
It is already on your box in all likelihood.
Here's how to set it up. Put this in your system-wide
bash configuration file:
alias bc="bc -q"
(That just gets rid of a bunch of unnecessary
printed info about bc. q = quiet.)
export BC_ENV_ARGS=/etc/bc
Then create /etc/bc with just this in it:
scale=3
(That sets the number of digits to right of
the decimal point will that be displayed.)
Then do this in every console/xterm you are
running at the moment:
$ . <path to system-wide bash configuration file>
or
$ source <path to system-wide bash configuration file>
Using bc:
$ bc
Then
2 * 4 <enter> # to multiply
16 / 2 <enter> # to divide
10 - 5 <enter> # to substract
20 + 20 <enter># to add
last or . stands for the last printed number:
$bc
2 * 8
16
. / 2
8.000
last + 8
16.000
You can also do stuff like:
$bc
(10 + 10) / 5
4.000
To exit bc: Ctrl-d (^D).
links:
http://www.gnu.org/software/bc/manual/
http://en.wikipedia.org/wiki/Bc_programming_language
Source: http://ftp.gnu.org/pub/gnu/bc/bc-1.06.tar.gz
size 72K
Dependencies:
$ldd `which bc`
linux-gate.so.1 => (0xffffe000)
libreadline.so.5 => /usr/lib/libreadline.so.5 (0xb7f4c000)
libncurses.so.5 => /lib/libncurses.so.5 (0xb7f0b000)
libc.so.6 => /lib/libc.so.6 (0xb7dc9000)
libdl.so.2 => /lib/libdl.so.2 (0xb7dc5000)
/lib/ld-linux.so.2 (0xb7f84000)
All of which are on most linux boxes.
Sid
Thanks S.L. !
I actually use this when I do my taxes. :)
Also consider starting it with the -l switch which defines a bunch of
math functions (trig, logs, and stuff).
-Beej
That's _serious_ math!
I know that bc can do it but just use it as a basic
calculator here.
>
> Also consider starting it with the -l switch which defines a bunch of
> math functions (trig, logs, and stuff).
Okay. I've considered it.
:-)
>
> -Beej
>
Thanks,
Sid
"Sidney Lambe" <nos...@nospam.invalid> wrote in message
news:m74is5x...@amma.net...
Although RPN fanatics would probably prefer dc the desktop calculator
ronafgreve@informationsuperhighway:~$ dc
2 4 *
p
8
16 2 /
p
8
q
:-)
> last or . stands for the last printed number:
>
> $bc
> 2 * 8
> 16
> . / 2
> 8.000
> last + 8
> 16.000
>
> You can also do stuff like:
>
> $bc
> (10 + 10) / 5
> 4.000
>
> To exit bc: Ctrl-d (^D).
>
> links:
>
> http://www.gnu.org/software/bc/manual/
> http://en.wikipedia.org/wiki/Bc_programming_language
>
> Source: http://ftp.gnu.org/pub/gnu/bc/bc-1.06.tar.gz
>
>.....
> Sid
>
>
Thanks.
Regards, Ron AF Greve
ROTFL! Now _there's_ a utility guaranteed to give you
a headache. It's worse than ed!
>
>> last or . stands for the last printed number:
>>
>> $bc
>> 2 * 8
>> 16
>> . / 2
>> 8.000
>> last + 8
>> 16.000
>>
>> You can also do stuff like:
>>
>> $bc
>> (10 + 10) / 5
>> 4.000
>>
>> To exit bc: Ctrl-d (^D).
>>
>> links:
>>
>> http://www.gnu.org/software/bc/manual/
>> http://en.wikipedia.org/wiki/Bc_programming_language
>>
>> Source: http://ftp.gnu.org/pub/gnu/bc/bc-1.06.tar.gz
>>
>>.....
>> Sid
>>
>>
> Thanks.
>
> Regards, Ron AF Greve
>
>
Cheers,
Sid
One more thing along these lines that might be installed on your Linux
box is the vi of spreadsheets:
sc
Start it up and hit '?' for help.
-Beej
You know, Mr. Beej, I have no idea how to use a
spreadsheet, which I believe to be a kind of database.
I can easily install it from the slackware cd, but
wouldn't know what to do with it.
I don't want to seem to be provincial, but can't in
good faith recommend an application that I don't know
a damn thing about and apparently have no use for.
Want to hear the bulk of a fine interview:
Lauren Weinstein
(http://www.vortex.com/)
It's about the future of the Internet.
He's on coasttocoastam (.com) right now. Here's where
to find the radio station carrying it nearest you:
http://www.coasttocoastam.com/info/wheretolisten.html
Sid
--
contact: http://tinyurl.com/5jxzoj
googlegroups users see:
http://tinyurl.com/5mbs7c