- From: Oriol Brufau via GitHub <sysbot+gh@w3.org>
- Date: Sun, 19 Sep 2021 19:29:28 +0000
- To: public-css-archive@w3.org
No, `max(0, var(--x)) / var(--x)` is NaN for 0. Use [`sign()`](https://drafts.csswg.org/css-values-4/#funcdef-sign) instead, this usecase was the reason I proposed it in #4673 So "use x^2 if x is positive but use 2*x if x is negative (and use +0 if x is ±0)" is ```css calc(max(0, sign(var(--x))) * pow(var(--x), 2) - min(0, sign(var(--x))) * 2 * var(--x)) ``` In https://github.com/w3c/csswg-drafts/issues/4731#issuecomment-581312064 I wrote a summary for writing `if(cond, then, else)` in terms of `sign()`. -- GitHub Notification of comment by Loirooriol Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6638#issuecomment-922524232 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Sunday, 19 September 2021 19:29:30 UTC