Re: [csswg-drafts] [css-values] round(A,B) with B negative (#4718)

> No, changing the sign of a mod/rem result is never correct

Sure, that's what happens when I write a long post in a hurry, something is gonna be wrong :)

I think the mostly correct one would be

```
A - round(down, A*sign(B), B)*sign(B)
```
e.g.
```
mod(4, 3) = 4 - round(down, 4, 3) = 4 - 3 = 1
mod(-4, 3) = -4 - round(down, -4, 3) = -4 - (-6) = 2
mod(-4, -3) = -4 + round(down, 4, 3) = -4 + 3 = -1
mod(4, -3) = 4 + round(down, -4, 3) = 4 - 6 = -2
```

the problem is with 0:

```
mod(+0, 3) = +0 - round(down, +0, 3) = +0 - 0 = +0 :)
mod(-0, 3) = -0 - round(down, -0, 3) = -0 + 0 = +0 :)
mod(+0, -3) != +0 + round(down, -0, 3) = +0 - 0 = +0 :(
mod(-0, -3) != -0 + round(down, +0, 3) = -0 + 0 = +0 :(
```

-- 
GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4718#issuecomment-580648355 using your GitHub account

Received on Friday, 31 January 2020 09:07:33 UTC