-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
sass/dart-sass
#2615Labels
enhancementNew feature or requestNew feature or requestunder considerationThe Sass team is debating whether to do thisThe Sass team is debating whether to do this
Description
https://github.com/sass/sass/blob/main/spec/types/number.md#fuzzy-equality
They are both finite numbers and the mathematical numbers they represent produce the same value when rounded to the nearest 1e⁻¹¹ (with ties away from zero).
In my understanding, "precision of 10" means two internal numbers are considered equal if they are equal after rounding them up to 1e⁻¹⁰, . In other words, with dart-sass being precision of 10, if two SassNumber
s serialize to the same String
after rounding, they should be equal, however, I discovered that fuzzy equality requires a precision of 11 in spec instead of precision of 10, which leads to a very confusing situation.
> a = SassNumber(0.0123456789)
0.0123456789
> b = SassNumber(0.012345678945)
0.0123456789
> a.toString() == b.toString()
true
> a.equals(b)
false
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestunder considerationThe Sass team is debating whether to do thisThe Sass team is debating whether to do this