-
Notifications
You must be signed in to change notification settings - Fork 747
Closed
Labels
Description
Hi,
I noticed that css-values-4 says that we should “simplify” a * (b + c) to ab + ac. However, in practice this means web pages will change; as long as all browsers implement these values as floats, these are not equivalent.
Even barring overflow and underflow cases, something as innocent as floor(3 * (4/3 + 1)) will be different from (3 * (4/3) + 3) (one becomes 6, the other becomes 7). For a case that doesn't involve floor(), 3 * (1 + 7/6) will round to 6 before and 7 now. (In the context of the standard, that would be someone writing e.g. calc(3 * (1px + 7em/6)) assuming em = 1px, just for the sake of the example.)
Constant folding makes sense, but is this really a good thing?