Allocating extra bits for mantissa of a float

T. William Wells bill at twwells.com
Fri Aug 25 23:11:34 AEST 1989


In article <13884 at netnews.upenn.edu> rowe at pender.ee.upenn.edu (Mickey Rowe) writes:
: I'm trying to find the zeroes of a function that blows up in an
: extremely narrow range.  To find these zeroes, I'm searching for
: places where the function becomes negative.  My problem is that the
: width of the curve where the function is negative may be smaller than
: 1e-16 where the value of the indepenent variable is on the order of
: 1e+2.  This requires that the mantissa of my variable retain at least
: (in some cases probably more) 18 significant figures.  Is there any
: (even remotely simple) way to get such precision without building my
: own computer?  I am currently working on a sun (I'm not sure of more
: than that except that it uses SunOS release 4.0).

You've been spoiled by floating point! :-)

Seriously though, unless the computation requires a large exponent
range, do everything in fixed point, using as many shorts as you might
need to get the precision you want. Or even implement floating point
with your own exponent and mantissa in a structure. Either way will
give you complete control over precision and the like. Of course, they
may also be slower....

---
Bill                    { uunet | novavax | ankh | sunvice } !twwells!bill
bill at twwells.com



More information about the Comp.lang.c mailing list