[css-values] mod(−0, +∞) and mod(+0, −∞) not handled correctly (original) (raw)

From https://drafts.csswg.org/css-values-4/#round-infinities

In mod(A, B) only, if B is infinite and A is non-zero and has opposite sign to B, the result is NaN.
Note: All other "infinite B" cases are valid, and just return A immediately.

This means that mod(−0, +∞) = −0 and mod(+0, −∞) = +0.

However, the returned value is supposed to be between zero and B, with

if B is positive the range starts at 0⁺, and if B is negative it starts at 0⁻.

So we should have mod(−0, +∞) = +0 and mod(+0, −∞) = −0.