Re: [csswg-drafts] [css-values] Iverson bracket functions (#4731)

Desugarings of `if(cond, then, else)` in terms of `sign()`:

 - `if(A < B, C, D) = max(sign(B - A), 0) * C + (1 - max(sign(B - A), 0)) * D;`
 - `if(A >= B, C, D) = max(sign(B - A), 0) * D + (1 - max(sign(B - A), 0)) * C;`
 - `if(A > B, C, D) = max(sign(A - B), 0) * C + (1 - max(sign(A - B), 0)) * D`
 - `if(A <= B, C, D) = max(sign(A - B), 0) * D + (1 - max(sign(A - B), 0)) * C`
 - `if(A != B, C, D) = abs(sign(B - A)) * C + (1 - abs(sign(B - A))) * D;`
 - `if(A == B, C, D) = abs(sign(B - A)) * D + (1 - abs(sign(B - A))) * C;`
 - `if(cond1 && cond2, C, D) = cond1 * cond2 * C + (1 - cond1 * cond2) * D;`
 - `if(cond1 || cond2, C, D) = sign(cond1 + cond2) * C + (1 - sign(cond1 + cond2)) * D;`
 - `if(!cond, C, D) = cond * D + (1 - cond) * C;`

(note `abs(A) = A * sign(A)` and `max(sign(A), 0) = sign(A) * (1 + sign(A)) / 2`).

The problem are comparisons with NaN or infinity.

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

Received on Monday, 3 February 2020 09:13:41 UTC