Thanks. I tried it, and (after some translation for gcc) found that
the atan2 replacement has good accuracy but is little if any faster
than the library atan2.
Hmm... well, thank you for giving it a try. The benchmarks for this
code were done four years ago, with CodeWarrior under OS9, and it was
tuned for the early G4, which may account for your speed observations.
(Library atan2 has no doubt improved as well.) Are you on G4 or G5,
and
single or double precision?
I compared OS X 10.3.6 atan2( y, x ) with the single version of your
function atan2r_.
In converting your CW code to gcc, one line caused many cold beers and
hot coffees to be consumed:
real32* asbuf = (real32*)(address(atanbuf_) + ind);
before an (int) cast emerged as a correct conversion:
real32* asbuf = (real32*)((int)&atanbuf_ + ind);
It should be noted that this code will break ppc64. Use intptr_t
instead: