W3C home > Mailing lists > Public > public-css-archive@w3.org > October 2020

[csswg-drafts] [cssom] Is `round` special in CSSOM? (#5689)

From: Chris Lilley via GitHub <sysbot+gh@w3.org>
Date: Sat, 31 Oct 2020 13:52:46 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-733725121-1604152365-sysbot+gh@w3.org>
svgeesus has just created a new issue for https://github.com/w3c/csswg-drafts:

== [cssom] Is `round` special in CSSOM? ==
Context: moving the serialization of &lt;color> values from CSSOM to CSS Color 4, per CSSWG resolution. I'm just checking that [the new Color serialization section]() has everything needed before sending a PR to replace the corresponding part of CSSOM with a pointer.

Several times in [Serializing CSS Values](https://drafts.csswg.org/cssom/#serialize-a-css-component-value) I see the phrase:

> rounded to the closest integer (rounding up if two values are equally close)

Looking at the documentation of [JavaScript `Math.round`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round)

> If the fractional portion of the argument is greater than 0.5, the argument is rounded to the integer with the next higher absolute value. If it is less than 0.5, the argument is rounded to the integer with the lower absolute value.  If the fractional portion is exactly 0.5, the argument is rounded to the next integer in the direction of +∞. 

and again for [C++](http://www.cplusplus.com/reference/cmath/round/)

> Returns the integral value that is nearest to x, with halfway cases rounded away from zero.

Then, for positive numbers, this seems to be merely a restatement of part of the algorithm. In other words, the next decimal digit after the place to be rounded can take any one of ten values: `0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9` and of those, half of them (`0`,`1`,`2`,`3`,`4`) round down and half (`5`,`6`,`7`,`8`,`9`) round up.

Thus, is there utility in retaining this wording? Or is it enough to just say "round". I'm happy either way, just want the Color 4 spec to be complete.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5689 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Saturday, 31 October 2020 13:52:48 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:21 UTC