archives

« Bugzilla Issues Index

#2604 — 7.1.11: incorrect rounding behaviour


Currently, ToUint8Clamp is specified to round numbers up if the number is halfway between two integers:

> 6. Let f be floor(number).
> 7. If f+0.5 ≤ number, then return f+1.

This is inconsistent with the WebIDL specification (referenced by the Khronos Typed Array specification):

> 1. Round x to the nearest integer, choosing the even integer if it lies halfway between two.
> 2. Set x to min(max(x, 0), 2^8 − 1).
> 3. Return the IDL octet value that represents the same numeric value as x.


fixed in rev24 editor's draft


fixed in rev24


actually, still not right in rev24. It needs to do "round half to even" tie-breaking.


Fixed in rev25 editor's draft


fixed in rev25 editor's draft