> > + > > +static double crackpot_sqrt(double val) > > +{ > > + int i; > > + float x, y; > > + const float f = 1.5F; > > + > > + x = val * 0.5F; > > + y = val; > > + i = * ( int * ) &y; > > + i = 0x5f3759df - ( i >> 1 ); > > + y = * ( float * ) &i; > > + y = y * ( f - ( x * y * y ) ); > > + y = y * ( f - ( x * y * y ) ); > > + return val * y; > > +} > > + > > For those interested, this is the Quake3 sqrt from Carmack ... there's > plenty of literature about it one or two google clicks away :-)
I guess that is a rough enough approximation for graphics. However it will be miscompiled unless i and y are put in a union. David _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev