[csswg-drafts] [css-values-5] Make UA, not author, deal with floating point errors in random() (#11864)

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

== [css-values-5] Make UA, not author, deal with floating point errors in random() ==
> Note that rounding issues might have an effect here: in random(100px, 200px, by 100px / 3) you’ll definitely get three possible values (100px, and approximately 133.33px and 166.67px),but whether 200px is possible depends on rounding precision. To be safe, you can put the maximum value slightly above where you expect the final step to land, like random(100px, 201px, by 100px / 3).

**Issue:** The author shouldn't need to think about floating point math errors. If the value is close enough to be functionally equivalent, the UA should just assume it matches.

**Proposal:** @tabatkins and I discussed this issue and suggest using 1% of the step value as "close enough", so if the final stepped value is within 1% of the step to the ending value (above *or* below), we use the end value as the final stepped value instead.

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


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

Received on Friday, 7 March 2025 23:40:57 UTC