FloatArrayPlugin & 64bitting
Tim Rowledge
tim at rowledge.org
Fri Apr 29 20:10:05 UTC 2005
In message <266c38f11b5e7ad322b984b76df5bed4 at inria.fr>
Ian Piumarta <ian.piumarta at inria.fr> wrote:
> float *argPtr;
> ...
> /* Check if any of the argument's values is zero */
>
> argPtr = ((float *) (interpreterProxy->firstIndexableField(arg)));
> for (i = 0; i <= (length - 1); i += 1) {
> if ((intAtPointer(argPtr + i)) == 0) {
> return interpreterProxy->primitiveFail();
> }
Looks very plausible, I'll give it a try.
>
> but that begs the question: why are we testing for integer 0 in an
> array of floats? Even if 0.0 happens to have all 0 bits, it would seem
> better to implement floatAtPointer() in sqMemoryAccess.h and compare
> against 0.0 (assuming the compiler and runtime agree on what
> constitutes floating 0 -- floating equality is a dodgy concept wherever
> it occurs).
My thoughts exactly but then I didn't write the code originally so have no idea
what reasoning lead to it. According to a quick google, zero has e of 0, m of 0
and s-bit of 0 or 1, so simply testing for (int)0 is only catching half the
possible corect values. So I suppose we really ought to be using something like
intAtPointer(blah) & 0x7FFFFFFF == 0
?
Who's the numerics afficionado now that Dave N Smith is no longer with us?
tim
--
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
Oxymorons: Government organization
More information about the Vm-dev
mailing list