Main Archive Specials Wiki | FAQ Links Submit Forum


pow(x,4) approximation

References : Posted by Stefan Stenzel

Notes :
Very hacked, but it gives a rough estimate of x**4 by modifying exponent and mantissa.

Code :
float p4fast(float in)
{
long *lp,l;

lp=(long *)(&in);
l=*lp;

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

/* compiler will read this from memory since & operator had been used */
return in;
}



Comments

There are no comments on this item

Add your own comment
Comments are displayed in fixed width, no HTML code allowed!
Email:

Comment:

Are you human?



Site created and maintained by Bram
Graphic design by line.out | Server sponsered by fxpansion