Note: There are a few cases of duplicates in user autocompletion which are being worked on.

stylo: percentages serialized with some float "rounding errors"

NEW
Unassigned

Status

()

Core
CSS Parsing and Computation
P2
normal
2 months ago
a month ago

People

(Reporter: bz, Unassigned)

Tracking

(Blocks: 3 bugs)

53 Branch
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

2 months ago
Created attachment 8875133 [details]
baz.html

Consider the attached testcase.  In Gecko, the two percentages on each line are the same.  In stylo, the following lines have them different:

15% 15.000001%;
27% 27.000002%;
30% 30.000002%;
53% 52.999996%;
54% 54.000004%;
59% 58.999996%;
60% 60.000004%;

This was caught by some mochitests.  Specifically, this causes dom/base/test/test_bug338679.html to fail.  Good thing it happened to use "15" as the value...

If I had to guess, servo is taking floats, converting to double, then serializing the double.
(Reporter)

Comment 1

2 months ago
Actually, looks like Gecko just asks the float-to-string machinery to produce 6 decimal digits of precision, rounding the last one; this is the general behavior of nsTSubstring_CharT::AppendFloat (the version that takes 32-bit floats).  The errors above are all in the 8th digit, so they get rounded away.
(Reporter)

Comment 2

2 months ago
Filed https://github.com/servo/servo/issues/17205
Priority: -- → P2
Blocks: 1320841
You need to log in before you can comment on or make changes to this bug.