w3c / w3c/csswg-drafts

[css-syntax-3][css-values-4] Add informative note about tokenization of negative 0

Open
#7,472 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

css-syntax-3 Needs Edits
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

I cannot tell which behavior is "right", if there is one, and I cannot think of an example for which it could matter, but I feel like an informative note (something like the note removed in this commit) about removing the sign of 0⁻ in convert a string to a number is required, especially in regards to calculations because a consequence is that calc(1 / -0) is calc(infinity) instead of calc(-infinity), which matches the output in JS, which performs division according to the rules of IEEE 754-2019, whereas in Type Checking (CSS Values):

Math functions follow IEEE-754 semantics for these operations

  • Dividing a positive value by zero produces +∞.
  • Dividing a negative value by zero produces −∞.

[...]

In other words, multiplying or dividing with 0⁻ follows standard sign rules

Can you also please tell me if there is any other difference between convert a string to a number and JS Number(), please?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the CSS Syntax 3 “convert a string to a number” section alongside CSS Values 4 “Type Checking (CSS Values)” and the referenced commit. Determine whether the negative-zero behavior and its relationship to JavaScript Number() need an informative note. Done means the Working Group has resolved the wording and the relevant specification text is updated.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.