Re: [csswg-drafts] [css-values] Add sign() math function (#4673)

But conditional functions were rejected in #3455 because they are too powerful. With `sign()` we can have some kind of conditions but it's just arithmetic so it's fine.

And about rounding options, it was just an example, but there are many others. 
For example, in case of tie maybe someone wants to choose the nearest even number, e.g. 6.5 rounds to 6 and 7.5 rounds to 8 (a bit strange but some language does this by default if I recall correctly).

So my point is that native CSS can't offer all possible behavior customizations, because there are so many options. Instead we should let authors achieve what they want with `sign()`, and if some behavior is very popular but not much readable with `sign()`, then add a nicer way in CSS.

The example could be

```css
--is-tie: calc((1 - hypot(sign(2*x - ceil(x) - floor(x)))) * sign(ceil(x) - floor(x)));
calc(round(x/2)*2 * var(--is-tie) + round(x) * (1 - var(--is-tie)));
```

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

Received on Wednesday, 15 January 2020 16:31:24 UTC