Re: [csswg-drafts] [css-values-4] What is the unit of `round(A, B)` if `A` and `B` have different units? (#12690)

> with Firefox just returning 0

It's not really that the expression resolves to zero. In Firefox it's just a parse error, so the entire value is dropped. Or when using variables, you get invalid at computed value time. 0 is just the initial value that you then get as a fallback.

```js
CSS.supports("rotate: atan2(2rem, 1px)") // false in Firefox, true in Chrome.
```

For the rounding error, note that the precision of numeric values is implementation-defined. And it's not surprising to see it when doing some back and forth with trigonometric functions. Ideally you should just use "unit algebra" like `2rem / 1px` without trigonometric hacks, but browsers don't support this yet.

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Sunday, 31 August 2025 19:59:02 UTC