Hi all,
the current implementation of rsqrt~ is most likely broken. i was sshing to carmen's amd64 machine ... looked like that filling the lookup table isn't really working ...
static void init_rsqrt(void) { int i; for (i = 0; i < DUMTAB1SIZE; i++) { float f; long l = (i ? (i == DUMTAB1SIZE-1 ? DUMTAB1SIZE-2 : i) : 1)<< 23; *(long *)(&f) = l; rsqrt_exptab[i] = 1./sqrt(f); } for (i = 0; i < DUMTAB2SIZE; i++) { float f = 1 + (1./DUMTAB2SIZE) * i; rsqrt_mantissatab[i] = 1./sqrt(f); } }
couldn't really look into it, but i guess, the wild cast in *(long *)(&f) = l; might be a problem on th x86_64 architecture ...
i don't have physical access to a 64-bit machine bit it should be no problem replacing long by int which is 32 bit in any case (i don't think there are any 16 bit platforms left, are they?!), or by some other 32-bit signed integer type, like __int32 under msvc.
best greetings, Thomas