Re: [csswg-drafts] [css-syntax-3][css-values-4] Add informative note about tokenization of negative 0 (#7472)

> Note that I didn't remove anything in that commit

I was referring to this part: *Note: that, outside of [=math functions=], ''-0'' just produces a "standard" zero, identical to ''0''-- **CSS as a whole doesn't recognize the concept of signed zeros***.

Without this note, if CSS claims that it obeys IEE754 semantics for *dividing a positive value by zero produces +∞*, I can not know why `calc(1 / -0)` is not `calc(-infinity)`...

> I'm somewhat loathe to put an explicit note or example about this into the spec, because it's a corner case that matters to approximately zero authors.

... but I'm fine with this position, ok.

> For implementors, the right behavior just falls out if they follow the specs.

For a JS implementation of *conversion from string to number*, following the spec does not help. I have to check for `0` and return it if the conversion equals 0.

> I didn't write the algorithm with any regard to JS's algorithm, but I expect they're probably very similar? I know that there's at least one difference, tho - "-0" produces a negative zero in JS, but not in CSS.

I *think* there is no other difference. From reading the [JS spec](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-runtime-semantics-stringnumericvalue), I can only note that `'Infinity'`, and decimal numbers in the exponent part, are valid but they are not allowed by the CSS grammar, therefore it does not matter.

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


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

Received on Friday, 8 July 2022 03:41:27 UTC