W3C home > Mailing lists > Public > www-svg@w3.org > December 2019

Re: Please add support for IEEE float number in SVG

From: Amelia Bellamy-Royds <amelia.bellamy.royds@gmail.com>
Date: Wed, 4 Dec 2019 22:49:28 -0700
Message-ID: <CAFDDJ7xYth=iwxRsAiqwv7WnKeV=rpwWpar-Vs98Tm1MKt+QUw@mail.gmail.com>
To: Hồ Châu <su_huynh@yahoo.com>
Cc: www-svg <www-svg@w3.org>
This is an interesting suggestion.

SVG 2 is harmonizing with CSS for number formats
<https://www.w3.org/TR/css-syntax/#consume-a-number>, so the addition
should be made there.

If you're able to file issues via GitHub, I'd recommend doing so here:
https://github.com/w3c/csswg-drafts/issues
Tag it in the subject line as [css-syntax][css-values]

That said, 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)
   <https://github.com/w3c/csswg-drafts/issues/4552>.

   - The `#nnnnnnnn` format is already used in CSS and SVG for colors.
   Parsing would be ambiguous in some CSS properties.

   - 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.


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.

~Amelia Bellamy-Royds


On Wed, 4 Dec 2019 at 20:44, Hồ Châu <su_huynh@yahoo.com> wrote:

> please add this feature: use hex float number instead decimal number. Use
> float hex number not lose precision from convert decimal when write file,
> then convert back to hex when read file. Useful for use SVG replace PDF and
> precision very important for high detail screen for high quslity printer.
>
> Example SVG file here use big endian IEEE float format for draw black
> circle with radius 100 at (50; 50), fill opacity 1.0:
>
> <svg version="1.1"  width="100" height="100" >
>
> <circle cx="#42480000" cy="#42480000" r="#42C80000" fill="#000000"
> fill-opacity="#3F800000" stroke="none" />
>
> </svg>
>
> Châu
>
>
>
Received on Thursday, 5 December 2019 05:49:40 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:55:18 UTC