Serious computation using floating-point numbers is a completely separate field from garden variety C-style programming. It has its own language (ForTran, still far ahead of the competition, and probably pulling away), culture and skills. Few people are proficient at both.

If you find yourself having to produce nontrivial numerical results in C, the definitive cookbook to reach for is:

Numerical Recipes in C: The Art of Scientific Computing, by Press, Flannery, Teukolsky and Vettering. Cambridge University Press 1988, ISBN 0-521-35465-X

(Versions for Fortran and Pascal are also available, along with complete software on floppy.)

An illustration of the cultural gap: In their programming style section, they suggest avoiding the C switch() statement, as a newfangled syntactic experiment which has yet to prove its worth...!

These guys know and love their craft, and are determined to give practical, useful help to folks hacking in the trenches, unlike many academic tomes.

This book features full source code for practical solutions to all the problems they discuss, along with sufficient explanation to give you a fighting chance of distinguishing use from abuse of the code. (The downside is that the code is copyrighted: You'll have to look elsewhere if you want to distribute your program.)

Most amazingly, they've managed to make a highly technical, moderately mathematical book which is actually fun to read! The first example in the book shows you how to compute the phase of the moon, and contains the classic marginal comment, "You aren't really intended to understand this..."

Mark Twain maintained that every man needs three books: A leather one to strop his razor, a thin one to shim the table, and a thick one to throw at the cat. My household has two cats, and two copies (ForTran and C) of this book...

Go to the first, previous, next, last section, table of contents.