Fixed point numeric routines.

Richard Tobin richard at aiai.ed.ac.uk
Wed Apr 11 06:16:12 AEST 1990


>>I assume that what I need are fixed point numeric routines which will
>>handle only a finite number of decimal places of precision.  

>If all amounts are guaranteed to be less than about $20 million, by far
>the simplest method is to use `long int' and measure money in pennies.

If you need larger amounts, you may find it possible to use floating
point *but still do everything in pennies*.  A double precision floating
point number should be able to store integers of around 50 bits without
loss of accuracy.

-- Richard
-- 
Richard Tobin,                       JANET: R.Tobin at uk.ac.ed             
AI Applications Institute,           ARPA:  R.Tobin%uk.ac.ed at nsfnet-relay.ac.uk
Edinburgh University.                UUCP:  ...!ukc!ed.ac.uk!R.Tobin



More information about the Comp.lang.c mailing list