W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2012

[WebIDL] Comments on [Clamp]

From: Kyle Huey <me@kylehuey.com>
Date: Sun, 10 Jun 2012 19:05:15 -0700
Message-ID: <CAP045AptyzHt070pm0X6UV7N59wbW4RdW+p2XNmReR-0Sj9hDg@mail.gmail.com>
To: public-script-coord <public-script-coord@w3.org>
Two things about [Clamp] (one of which I've already mentioned to Cameron.)
(I've used byte for the examples here.)

1. Can we make it explicit that -0 is converted to 0?  It is not clear to
me that the steps

   1. Round x to the nearest integer, choosing the even integer if it lies
   halfway between two.
   2. Set x to min(max(x, −27), 27 − 1).

preclude x from being -0.

2. Can we reorder the steps so that the clamping happens before the
rounding?  e.g.

   1. Set x to min(max(x, −27), 27 − 1).
   2. Round x to the nearest integer, choosing the even integer if it lies
   halfway between two.

This doesn't actually change the results, but it is easier to read IMO.  It
also doesn't require us to wrap our heads around what "round" means for
infinities.

- Kyle
Received on Monday, 11 June 2012 02:05:45 UTC

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