Skip to content

[css-typed-om-1] "equal numeric values" algorithm is possibly problematic #681

@bzbarsky

Description

@bzbarsky

In https://drafts.css-houdini.org/css-typed-om-1/#equal-numeric-value say value1 and value2 are both CSSMathSums. Specifically, say value1 is CSSMathSum(2em, 1px, 2em) and value2 is CSSMathSum(1px, 2em, 1px). Pretty sure you can get those via add().

AS the algorithm is currently written in step 3 the "values" slots have the same sizes, so step 3 substep 1 does not return.

In step 3 substep 2, each item in value1 does in fact have a corresponding equal numeric item value in value2, so we do not return. Depending on how one defines "corresponding", but the usual meaning is basically "a function from the items in value1 to the items in value 2".

In step 3 substep 3 true is returned. But these two values should not be considered numerically equal.

The simplest way to fix is probably to say that we should return true if there is a one-to-one correspondence between the items of value1 and the items of value 2 such that corresponding items are equal numeric value. That fixes the problem of the function not being bijective.

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