[css-houdini-drafts] [css-typed-om-1] "equal numeric values" algorithm is possibly problematic

bzbarsky has just created a new issue for https://github.com/w3c/css-houdini-drafts:

== [css-typed-om-1] "equal numeric values" algorithm is possibly problematic ==
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.

Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/681 using your GitHub account

Received on Friday, 16 February 2018 01:31:14 UTC