W3C home > Mailing lists > Public > public-css-archive@w3.org > December 2019

Re: [csswg-drafts] [css-syntax][css-values] Add IEEE 754 float hex format SVG/CSS values (#4564)

From: Amelia Bellamy-Royds via GitHub <sysbot+gh@w3.org>
Date: Thu, 05 Dec 2019 22:59:20 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-562356437-1575586759-sysbot+gh@w3.org>
To keep the discussion in one place, here's [my reply](https://lists.w3.org/Archives/Public/www-svg/2019Dec/0004.html) from when this request was [originally posted to the www-svg mailing list](https://lists.w3.org/Archives/Public/www-svg/2019Dec/0003.html).

Key points (beyond suggesting filing it here):

> I can see a few obstacles:
> 
> - SVG currently only [requires single-precision floats](https://svgwg.org/svg2-draft/types.html#Precision), not double.  CSS doesn't currently specify precision requirements; there is an open issue suggesting that it should be formally made undefined behavior (#4552). 
> - <del>The `#nnnnnnnn` format is already used in CSS and SVG for colors. Parsing would be ambiguous in some CSS properties.</del> *[Edit: this issue is addressed by using an 0x syntax]*
> - CSS (and SVG) are mostly harmonizing with JavaScript (ECMAScript) for any new Math-related features, and JavaScript doesn't have any hex-based formats for floats. *[Edit: the 0x syntax is a problem from this perspective, since in JavaScript it is always interpreted as an integer, not a float!]*
> 
> You might get more support for a request to specify the parsing/rounding rules for converting between decimal representation and binary floats (which would most likely match the [ECMAScript specification](https://tc39.es/ecma262/#number-value), and use the "round to nearest, with ties to even" rule). With this guaranteed, you could be confident that a decimal version of a number would always parse into the same binary representation. But first, the precision level (single or double float) would need to be defined.


-- 
GitHub Notification of comment by AmeliaBR
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4564#issuecomment-562356437 using your GitHub account
Received on Thursday, 5 December 2019 22:59:22 UTC

This archive was generated by hypermail 2.4.0 : Thursday, 24 March 2022 20:27:05 UTC