Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fast & accurate sine / cosine pairs



Thanks for all the responses. Thought I'd write a follow up in case anyone else was interested or searching for something similar...

My description was slightly wrong, the sample rate was 9,765.625 as opposed to 2,500,000. This means that the angle input to the sine / cosine calculation can be as large as ~3,500,000. For values at this magnitude, single precision floating point becomes pretty useless: the inputs to the sine / cosine algorithm were inaccurate, not the algorithm itself.

To get round this I use extra precision for the angle calculation and the initial range reduction step of the sine / cosine algorithm before doing the rest of it with Altivec as before.



I initially tried to use "double-float" arithmetic (using two Altivec single precision values to emulate a double precision value) using the "double-double" algorithm from the QD library:
http://crd.lbl.gov/~dhbailey/mpdist/
However, in practice this method (particularly the rounding / range reduction step) does not offer much parallelism and causes a large number of instruction stalls.


Simply implementing the angle calculation and rounding step in scalar double precision seems to get much better performance (particularly with 2 FPUs on the G5). The only caveat is converting the double precision values to single precision and then storing them to memory before they can be loaded into the Altivec unit.



r i c k
_______________________________________________
Do not post admin requests to the list. They will be ignored.
PerfOptimization-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/perfoptimization-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.