- From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
- Date: Thu, 22 Aug 2024 21:46:54 +0000
- To: public-css-archive@w3.org
> First, expecting 1em as the result of pow(1em, 2) would be inconsistent with [sign(1em)](https://drafts.csswg.org/css-values-4/#funcdef-sign) or [abs(1em)](https://drafts.csswg.org/css-values-4/#funcdef-abs) The note isn't about the expectations who have read and fully internalized the spec algorithms, it's about people just looking at `pow(2em, 2)` and guessing what it does. Most people would guess the result as `4em`, and that's a reasonable thing to do. See, for example, [this very old StackOverflow question](https://stackoverflow.com/questions/9549525/exponentiation-in-sass) (predating Sass's `pow()` support), where someone is discussing writing their own `pow()` function, and explicitly wanting to strip the unit off the first argument and put it back after the exponentiation. > Or should sign() and abs() only work on numbers too? No, both of those act the same whether you use the argument as written or properly resolve it first. (Similarly, `hypot()` works the same either way, so it is allowed to take values with units, even tho internally it's squaring and square-rooting, both of which CSS won't let you do with unitted values.) > Second, opacity: sqrt(100%) and color: lab(0 sqrt(100%) 0) are valid. They're not valid. Per ["type of a calculation"](https://drafts.csswg.org/css-values-4/#determine-the-type-of-a-calculation), the type of their argument is {"percent" -> 1}, which doesn't resolve to a number. -- GitHub Notification of comment by tabatkins Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10765#issuecomment-2305800415 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 22 August 2024 21:46:55 UTC