Re: [csswg-drafts] [css-color-4] Achromatic colors converted to hue-ish spaces should treat hue as "missing", not NaN (#6107)

> If a top-level calculation (a math function not nested inside of another math function) would produce a value whose numeric part is `NaN`, it instead act as though the numeric part is `+∞`. 

and

> a "real" `NaN` should be treated the same as an `infinity`

What I'm not seeing is

a) an explanation of why that spec text is a good and useful thing (divide by zero produces `infinity` or `-infinity`, not `NaN`)
b) how the value "missing" is supposed to be passed around in an API which has `number`, `float` or `double` parameters. Obviously it can be represented textually in CSS syntax, or in the (string-based) CSS OM but how can it 

Several color APIs use NaN here ([d3.js](https://d3js.org/) for example, which [also uses it for missing data in general](https://observablehq.com/@d3/line-with-missing-data), [colorio](https://github.com/nschloe/colorio) and [color.js](https://colorjs.io/api/) too. It seems natural that the Color API would do this too.

So first we need to understand why CSS V&U wants to map `NaN` to  `+∞`.

I see @LeaVerou [asked a similar question earlier](https://github.com/w3c/csswg-drafts/issues/4954#issuecomment-712446608)

> I don't understand the sentence "it produces a NaN, which is censored into an infinity". Mathematically, 0/0 does not tend to infinity and is an indeterminate form.

A [quick search for `NaN` in V&U4 issues](https://github.com/w3c/csswg-drafts/issues?q=nan+is%3Aissue+label%3Acss-values-4+) didn't turn up any motivation for this strange censoring.

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


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

Received on Friday, 19 March 2021 17:00:00 UTC