Re: [csswg-drafts] [css-color-4] Computed value and serialization of `Infinity` and `NaN` in color functions (#8629)

  > What part of the spec is leading you to believe that a top-level `NaN` doesn't serialize as such? I might have made a mistake.

The part that we both referred to (edited for clarity):

  > - If a top-level calculation would produce a value whose numeric part is `NaN`, it instead act as though the numeric part is `0`. 
  > - If a top-level calculation would produce a value whose numeric part is `0⁻`, it instead acts as though the numeric part is the standard "unsigned" zero.

Taking Example 38 following this part:

  > `calc(-5 * 0)` produces an unsigned zero — the calculation resolves to `0⁻`, but as it’s a top-level calculation, it’s then censored to an unsigned zero.

`calc(0 / 0)` produces `0` — the calculation resolves to `NaN`, but as it’s a top-level calculation, it’s then censored to zero.

Basically my understanding meant that `NaN` could only appear in the serialization of unresolved nested calculations.

---

I am also missing why Chrome currently serializes the next example to `calc(infinity)` instead of `calc(-infinity)`.

  > On the other hand, `calc(1 / calc(-5 * 0))` produces `−∞` [...] the inner calc resolves to `0⁻`, and as it’s not a top-level calculation, it passes it up unchanged to the outer calc to produce `−∞`

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


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

Received on Thursday, 23 March 2023 08:05:55 UTC