From: Alan G. <ag...@sp...> - 2008-06-26 17:36:23
|
I'm searching through the code for hard coded constants.......... I hope everybody is aware that math.h (C), and it's successor, cmath (C++) contains #defines for just about every irrational constant you might require defined out to the limits of machine precision... For example, the code: y = x / 1.44; should be written as: y = X * M_SQRT1_2; since dividing something is equivalent to multiplying by it's reciprocal, and since the designers of C++ thoughtfully included the reciprocal as a constant, and because multiplication is a faster operation, this is the preferred method. =) -- Ron Paul: A man of Peace. Chemistry.com: A total rip-off. Powers are not rights. We did not invade Iraq, the government did. |