[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] typed arrays + edge cases

On 2/3/2010 7:15 PM, Oliver Hunt wrote:
On Feb 3, 2010, at 7:04 PM, Chris Marrin wrote:

- If the array type is float and someone bit-fiddles an unusual NaN in there, does that unusual NaN get passed to the engine to deal with (even if it might not normally use them, e.g. signalling NaN etc.)?

Suggestion: I don't have a good one. The engine should maybe convert all NaNs into whatever NaN it understands on element access?
I think all invalid NaN variants should be converted to a quiet NaN, which is what JS supports, right? I think the values we should support are all valid, normalized floats, +/-Inf and a quiet NaN. Everything should be converted to a quiet NaN.
I think the specific question is what happens in a case like:

buffer = new ArrayBuffer(n);
bytes = new UnsignedByteArray(buffer);
doubles = new DoubleArray(buffer);
b = bytes[0]
d = doubles[0]
doubles[0] = d

if (b === bytes[0])
     log("b is unchanged");
     log("b has changed");

From the PoV of JSC at least it is far safer to to allow the exact bits to change, and i don't believe it's possible to guarantee no bit changing for floats as conversion to or from double will necessarily result in different bits for non-normalised values at least.

Yep, that was part of it.. and what you suggest is totally fine to me. doubles[0] = d is a new assignment, and the value of d is up to the JS engine.

    - Vlad

You are currently subscribe to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: