W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2009

Re: [WebIDL] double

From: Ian Hickson <ian@hixie.ch>
Date: Mon, 15 Jun 2009 16:52:54 +0000 (UTC)
To: Cameron McCormack <cam@mcc.id.au>
Cc: public-webapps@w3.org
Message-ID: <Pine.LNX.4.62.0906151652431.16244@hixie.dreamhostps.com>
On Mon, 15 Jun 2009, Cameron McCormack wrote:
> Ian Hickson:
> > Oh. Wouldn't it make more sense for JS compatiblility to have float be 
> > 64-bit? It seems bad to have a type that is 32-bit but then have its most 
> > common implementation not throw an exception or anything if setting a 
> > number that is 64-bit into it.
> 
> When converting Number values to IDL short or long, for example, the
> ToInt16 and ToInt32 operators do things other than throw exceptions, and
> instead coerce the number into the right range.
> 
> > Or do UAs treat 'float's as 32-bit and trim the numbers when storing
> > them?)
> 
> Seems they do store them as 32-bit, just with one quick test:
> 
>   <svg xmlns='http://www.w3.org/2000/svg'>
>     <script>
>       var p = document.documentElement.createSVGPoint();
>       p.x = 1.23456789012;
>       var y = p.x;
>       alert(y);
>     </script>
>   </svg>
> 
> alerts 1.2345678806304932 in Opera 10 beta, a recent Firefox nightly and
> a recent WebKit in Midori.

Excellent, thanks.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Monday, 15 June 2009 16:53:30 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:31 GMT