A desk calculator with formula definition

Gary Perlman perlman at wivax.UUCP
Mon Dec 10 03:00:21 AEST 1984


UNIX|STAT, my public domain stat packagge has a similar calculator.
Looking at the sender's address, I guess the one recently described is not.

> Some time ago I wrote a simple desk calculator for myself using Yacc and
> Lex, as suggested by the example in the Yacc document. My excuse was that
> I wanted a simple floating point capability, with trig and fractional
> powers, which dc and bc don't provide.  I also provided for arbitrary length
> variable names; a huge improvement over bc in my opinion.

My calc has all of these.

> Some time later, I enhanced it with a formula definition capability.
> I can type a line like:
> 
> #define alpha "(1 - beta^2)^.5)"
> #define PI "3.1415926535"
> #define theta "t*PI/180"
> #define x "((1+A^2-2*A*cos(theta))^.5)"
> #define b "((A+x)^2-1)/2/A/x^3"
> A=.723

my calc differs by using name=definition format,
and it stores the parse tree so it should be more efficiient.

More info on calc and UNIX|STAT can be obtained from the address below.
	Gary Perlman
	Wang Institute
	Tyng Road
	Tyngsboro, MA 01879 USA
	(617) 649-9731



More information about the Comp.unix mailing list