Uint8ClampedArray rounding behaviour?
# Boris Zbarsky (11 years ago)
On 4/5/14 9:44 PM, Qantas 94 Heavy wrote:
Am I reading this completely wrong, or is there a discrepancy in the behaviour between the ES6 version and what's currently implemented in browsers?
You're reading correctly. The ES6 version is wrong and should be fixed.
# Allen Wirfs-Brock (11 years ago)
Bug report? What's the the correct behavior?
# Allen Wirfs-Brock (11 years ago)
Err oops, sorry I missed the top post
Currently, the ES6 spec uses ToUint8Clamp to convert the set value into a number in a Uint8ClampedArray. From what I read of the spec, ToUint8Clamp rounds ties away from zero (rev 22, 7.1.11):
However, in the WebIDL spec (4.2.5, step 3), it's specified to round to the nearest even integer:
halfway between two.
Currently, both Firefox and Chrome round ties to even, not away from zero. Am I reading this completely wrong, or is there a discrepancy in the behaviour between the ES6 version and what's currently implemented in browsers?