[music-dsp] Optimisation

Luca mds at hypercatalog.com
Sat Feb 12 12:58:30 EST 2000


On 2/12/2000 9:07 AM, Stefan Stenzel (Stefan at Stenzel.com) shared his 
wisdom:

>  l-=0x3F800000l; /* un-bias */
>  l<<=2;          /* **4 */
>  l+=0x3F800000l; /* bias */

Well this loses the sign after multiplying the exponent by 4 and moving 
the 2nd and 3rd
bits of the mantissa into the exponent... so 256 (2^8) turns into ~4 
billion (2^32.)
I'm sure Stefan meant l += 0x01000000; (which is quite inaccurate but not 
*that*
inaccurate :-) It's also considerably slower than just the 2 fp 
multiplications
on any platform with a FPU.

Now if you wanted a wild guess for x^1/4, that's another matter...

dupswapdrop -- the music-dsp mailing list and website: subscription info,
FAQ, source code archive, list archive, book reviews, dsp links
http://shoko.calarts.edu/musicdsp/




More information about the music-dsp mailing list