W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2012

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

From: Masayuki Nakano <masayuki@d-toybox.com>
Date: Mon, 19 Mar 2012 13:57:52 +0900
Message-ID: <4F66BCD0.1060906@d-toybox.com>
To: Glenn Maynard <glenn@zewt.org>
CC: "www-dom@w3.org" <www-dom@w3.org>
On 2012/03/18 11:45, Glenn Maynard wrote:
> On Sat, Mar 17, 2012 at 8:57 PM, Masayuki Nakano <masayuki@d-toybox.com
> <mailto:masayuki@d-toybox.com>> wrote:
>
>     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'd expect this to happen with 0.1, but 1.0 is exactly representable by
> both floats and doubles...)

I'm sorry, it's just my mistake. You're right.

-- Masayuki Nakano <masayuki@d-toybox.com> Manager, 
Internationalization, Mozilla Japan.
Received on Monday, 19 March 2012 04:58:23 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:09 GMT