[csswg-drafts] [css-values] Define round() more precisely in presence of infinity / nan. (#8020)

emilio has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-values] Define round() more precisely in presence of infinity / nan. ==
I was reviewing a patch to add `round()` to Gecko. In that implementation, we need to handle a bunch of special-cases in numerical edge cases to make various tests work (e.g., `round()` with an step of infinity, zero etc).

I don't see anything defining it precisely in [the spec](https://w3c.github.io/csswg-drafts/css-values/#funcdef-round), so for now I approved the changes making the tests pass, but it'd be good to have a more precise definition for each rounding mode to know which precise floating point operations are supposed to happen.
 
That is, given two floating numbers a and b, how exactly should the upper and lower bounds be computed and compared to reach the answer? Without accounting for inf/nan etc it doesn't particularly matter which order you operate, but with them it does.

Depending on how we define this, this would potentially allow to remove some special cases and make `round()` faster in the common case.

cc @tabatkins 

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 4 November 2022 20:06:20 UTC