8000 [css-values-4] Simplification changes semantics · Issue #9437 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

[css-values-4] Simplification changes semantics #9437

@sesse

Description

@sesse

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0