Log Library - How is it done in the library code?

John A. Weeks III john at newave.UUCP
Sat Mar 16 15:38:59 AEST 1991


In article <1991Mar12.014416.4289 at m.cs.uiuc.edu> joshi at m.cs.uiuc.edu (Anil Joshi) writes:
> I do not want the accuracy that might have been provided in the c library 
> log(). It might be spending more time than necessary to calculate more
> accurately than I want it to be. 

> I am tending towards Idea 3, which seems to be fastest (my intuition).

As an experiment, why not try running your program using log, then
try one of the alternate solutions.  Compare the time it takes to run
each example.  Then post your results to the net.

What I expect you to find is that the difference is rather small--an
optimized hand coded assembly routine or a math coprocessor call as
compared to a C routine.  I have often found that the program algorithm
makes a far greater impact on performance than optimizing small pieces
of code.  But since you sound like you will be using log extensively, it
might make a great deal of difference.  If you do find a difference, I bet
that the difference will vary greatly between different machines.

-john-


-- 
-----------------------------------------------------------------------------
John A. Weeks III               (612) 942-6969             john at newave.mn.org
NeWave Communications                       ...uunet!tcnet!wd0gol!newave!john



More information about the Comp.lang.c mailing list