Re: [csswg-drafts] [css-values] Let B default to 1 in `round(<strategy>?, A, B)` (#9668)

> Let's say `1em = 16px`, then `round(2.3em)` should produce the same as `round(36.8px)`.

Converting the unit _before_ rounding is totally unexpected from an author's standpoint.

> we can't have the unit depend on the input (for the reasons given, plus things like round(1em + 10px) that don't have a single unit), and we don't want to default a mystery unit that might violate author expectations.

The point was for rounding when only having a single unit. So, `round(1em + 10px)` would still be invalid. Only `round(2.3em)`, `round(42.8deg)`, or `round(87.39%)` would be valid (being equivalent to `round(2.3em, 1em)`, `round(42.8deg, 1deg)`, and `round(87.39%, 1%)`, respectively).

Allowing to omit B for numbers but not dimensions or percentages may cause confusion.

> Like, in English people just say "round x", not "round x to a multiple of 1".

Not just spoken languages but also also in many programming languages you can omit the precision - or even don't have a way to define one like in JavaScript.

Sebastian


-- 
GitHub Notification of comment by SebastianZ
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9668#issuecomment-1843715904 using your GitHub account


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

Received on Wednesday, 6 December 2023 21:26:13 UTC