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

The CSS Working Group just discussed `sign()`, and agreed to the following:

* `RESOLVED: add the sign() function as described in the issue, restricted to numbers only`

<details><summary>The full IRC log of that discussion</summary>
&lt;bkardell_> topic: sign()<br>
&lt;bkardell_> TabAtkins: this one was opened by oriol, asking for Math.sign equivalent, the usecase presented is hacky, but sure, why not - it seems unobjectionable - I'm happy to add it... he notes you can actualy implement it yourself, it is even worse<br>
&lt;astearns> github: https://github.com/w3c/csswg-drafts/issues/4673<br>
&lt;bkardell_> myles_: should the sign of 1px be....<br>
&lt;bkardell_> heycam: it should return a number if we allow lengths<br>
&lt;bkardell_> emilio: what about percentages?<br>
&lt;bkardell_> TabAtkins: 50% should resolve to whatever that resolves to<br>
&lt;bkardell_> bkardell_: in ..pixels<br>
&lt;bkardell_> TabAtkins: in many cases, pixels, but whatever that resolves against<br>
&lt;heycam> make calc(sign(1px)) == 1, because you usually use the result of sign() to multiply against other things<br>
&lt;bkardell_> myles: you could always add non-numbers later<br>
&lt;bkardell_> heycam: does css really support positive and negative values?<br>
&lt;dbaron> s/values/zeroes/<br>
&lt;Rossen___> q?<br>
&lt;bkardell_> TabAtkins: in calc, yes - we use the js semantics -- once you exit the calc no... it can affect the infinity<br>
&lt;dbaron> TabAtkins: yes, but only inside of calc()<br>
&lt;bkardell_> fantasai: I dont think you can parse one in?<br>
&lt;bkardell_> dbaron: you can write an negative 0, but it is just 0<br>
&lt;bkardell_> TabAtkins: if you produce a negative 0 as a result of the calc, you can have a negative 0<br>
&lt;bkardell_> Rossen___: is there a use case for that?<br>
&lt;bkardell_> TabAtkins: consistency with JavaScript?<br>
&lt;bkardell_> Rossen___: so we _want_ that in this case? :)<br>
&lt;bkardell_> TabAtkins: you can insert directly via typed om, actually<br>
&lt;bkardell_> TabAtkins: anyone have an objection to sign() restricted to numbers only?<br>
&lt;bkardell_> Rossen___: any objections?<br>
&lt;astearns> cbiesinger: Tab explained you get negative zero by dividing by negative infinity, which you get by -1/0<br>
&lt;bkardell_> RESOLVED: add the sign() function as described in the issue, restricted to numbers only<br>
</details>


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

Received on Wednesday, 22 January 2020 10:06:47 UTC