[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Simple calculator



Previously Neale Pickett wrote:
> Anyhow, I have been very impressed with some of the calculators proposed 
> here; so impressed that I coded them all up as bourne shell functions
> and did some profiling.  Because, after all, the speed of your two-digit 
> division is important stuff!

Okay, I'm somewhat late, but there are more. Ther is dc, which can
do arbitrary precision:
  echo "10k 20 13/P" | dc
for 10 digits, or
  echo "100k 20 13/P" | dc

There is also a implementation of dc written in sed, see
/usr/doc/sed/examples/dc.sed.gz if you have a recent sed package. To use
it gunzip it and do
	echo "10k 20 13/P" | dc.sed
It's slow, but I'm giving the person who wrote dc.sed major geek points..

Wichert.

-- 
==============================================================================
This combination of bytes forms a message written to you by Wichert Akkerman.
E-Mail: wakkerma@wi.LeidenUniv.nl
WWW: http://www.wi.leidenuniv.nl/~wichert/

Attachment: pgpPhSCl3SKRl.pgp
Description: PGP signature


Reply to: