[DOM3 Events] Error between float vs. double of WheelEvent

I'm now implementing D3E WheelEvent on Gecko.
https://bugzilla.mozilla.org/show_bug.cgi?id=719320

I realized that Gecko's javascript always use double for non-integer 
Number. Therefore, if I defined deltaX, deltaY and deltaZ as float, that 
could have caused error at copying float to double.

E.g., following function returns false when I defined them as float.

function () {
   var event = new WheelEvent("wheel", { deltaX: 1.0 });
   return (event.deltaX == 1.0);
}

because the deltaX becomes 1.000000xxxxxxxxx (x means random number) by 
the error.

I think that Gecko should define them as double for avoiding this bad 
behavior. Olli agreed with this idea at comment 6 in the bug.

However, this can make incompatibility with other browsers because this 
really depends on the JS implementation. I don't know whether I should 
suggest to change the definition from float to double or not. Some 
implementation might have same problem if the definition is changed so...

-- 
Masayuki Nakano <masayuki@d-toybox.com>
Manager, Internationalization, Mozilla Japan.

Received on Sunday, 18 March 2012 01:57:29 UTC