Re: [csswg-drafts] [cssom] Serialize numbers using scientific notation? (#8538)

While it is good to see that small numbers will be serialized with great precision (7 digits) there is a noticeable 'jump' in precision between "e-6" and "e-7".
For example `1.987654321e-7` or `0.0000001987654321` would be serialized as `1.987654e-7` (aka `0.0000001987654`), but `1.987654321e-6` or `0.000001987654321` as `0.000001` (aka `1e-6`), dropping the precision from 7 digits to 1.

Allowing "_6 significant digits_" instead of "_truncating to 6 digits_", for numbers between 0 and 1, would eliminate that 'jump'.
Besides making the whole behavior more consistent, and understandable for authors, it would make working with very small (but not excessively small, i.e. e-1 to e-6) numbers a lot safer.
This is the current behavior of Firefox and PDFreactor (except for scinot) and we cannot easily change that in PDFreactor, as we had use-cases where a strict 6 decimals limit would interfere with the results.

(A similar 'jump' happens when large numbers switch to scinot and limiting significant digits would also solve that. Again this is already the behavior of Firefox and PDFreactor. However this isn't really a significant issue.)

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


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

Received on Wednesday, 29 May 2024 12:54:54 UTC