- From: Guillaume via GitHub <sysbot+gh@w3.org>
- Date: Sun, 10 Jul 2022 05:45:41 +0000
- To: public-css-archive@w3.org
> My question: what should the behavior be when the units of the arguments are different, but the types are the same? What should happen if a calculation cannot be simplified to a single number? Math functions are simplified *to the extent possible*. See [10.10.1. Simplification](https://drafts.csswg.org/css-values-4/#calc-simplification): > 4. If `root` is an operator node that’s not one of the calc-operator nodes, and all of its calculation children are numeric values with enough information to compute the operation root represents, return the result of running `root`’s operation using its children, expressed in the result’s canonical unit. There is not enough information to resolve percentages (except when replacing a `<number> | <percentage>`), viewport or font-relative units, therefore a math function that includes such values is not simplified at parse time but at computed value time. > Perhaps a better question: why does this function accept units at all? Why not only allow calculations that resolve to a <number> similar to some of the other math functions? Since the units aren't actually used, it just seems confusing. Units should be used. I'm not a spec author so please do not take my words for granted. But I went through the implementation of math expressions, so I hope it helps. -- GitHub Notification of comment by cdoublev Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7482#issuecomment-1179661277 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Sunday, 10 July 2022 05:45:43 UTC