[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: OT : Approximate / fast math libraries ?

On Sat, 1 Sep 2007, Chris Jones wrote:

> > Another poster mentioned that pentiums
> > have hardware instructions for trig functions.
> > If you are using them, there isn't much hope for speed up.
> Out of interest, whats needs to be done to use these, some gcc flag ? My

gcc won't use them unless it knows that your version of the cpu has them.
You probably need to add a flag that tells gcc exactly what cpu you have.
You might also need -ffast-math .
If all else fails, there is always inline assembly.

> profiling suggests that atan2(x,y) is taking ~ 50% of some method speed. Yes,
> the methods is already fast, but still is this reasonable if hardware
> instructions are being used. Is there some way I can check to see exactly
> what is used ?

objdump -S  galadriel.elf > galadriel.lss
Will produce an disassembly listing intermixed with source.

> > These formulas will probably not be useful unless
> > you know in advance the ranges of their arguments.
> Yes, I considered coding up my own methods along this line, but figured
> getting it correct was not a small amount of effort, and was hoping to find
> some project that had done it for me.

How much precision do you need?  On what? Why?

At least one person wrote a book on implementing the C standard library.
It would probably be a better resource than Numerical Recipes.

Mike   hennebry web cs ndsu NoDak edu
"Horse guts never lie."  -- Cherek Bear-Shoulders

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]