W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2011

Re: Double-to-integer conversion behavior and options

From: Cameron McCormack <cam@mcc.id.au>
Date: Fri, 09 Sep 2011 18:33:39 +1000
Message-ID: <4E69CF63.9050104@mcc.id.au>
To: Boris Zbarsky <bzbarsky@MIT.EDU>, David Flanagan <dflanagan@mozilla.com>
CC: "public-script-coord@w3.org" <public-script-coord@w3.org>
On 23/08/11 1:47 PM, Boris Zbarsky wrote:
> Two changes I was talking to Cameron about that might be worth
> considering for WebIDL:
>
> 1) [Clamp] conversions should probably round to nearest, ties to even,
> instead of flooring. Otherwise you introduce persistent bias toward zero
> on floating-point rounding errors, whereas [Clamp] sort of requests sane
> behavior.
>
> 2) We should introduce some sort of [EnforceRange] so that specs can
> declare range restrictions that involve throwing when out of range (as
> opposed to clamping, which [Clamp] handles) in the IDL. This should
> presumably throw after rounding toward 0 (instead of doing a floor) so
> that the common case of wanting to enforce a nonnegative number with
> exceptions when negative will work ok in the presence of small roundoff
> errors.

I've made these changes.

http://dev.w3.org/cvsweb/2006/webapi/WebIDL/Overview.html.diff?r1=1.393;r2=1.394;f=h

Boris and David (since your earlier comment "ยง4.2.9: conversion to 
unsigned long and bounds checking" is similar) please let me know if the 
change is satisfactory.

Thanks,

Cameron
Received on Friday, 9 September 2011 08:34:24 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:04 UTC