Math Formulae

Tom Leylan tleylan at pegasus.com
Sat Dec 29 18:39:01 AEST 1990


This doesn't have to be done in C necessarily but I know this is where
all the smart programmers hang out...

I have a number of involved calculations to make (sets of them for various
conditions) and I wondered if there is a way to approach this besides
dozens of SWITCH statements and IF...ELSE and all the other conditionals ?

Particularly useful would be the ability to have it "read" like one would
describe the problem in English but I don't expect that.

For instance :  cost is 3% of total unless total is greater than $1000 then
cost is 3% of the first $1000 and 2% of the balance.  A minimum charge of
$20 applies.

Know what I mean ?  Is there a math library or a programming discipline
that I could apply here ?

Many thanks.

tom

j



More information about the Comp.lang.c mailing list