Skip to content

[css-values-4] Should pow()/sqrt()/sign()/abs() only take calculations matching <number>? #10765

@cdoublev

Description

@cdoublev

pow() and sqrt() take calculations that must resolve to a <number>.

There is a note explaining why they only work with numbers. I understand the first argument but the second one confuses me:

[...] the result is dependent on what unit you’re expressing the argument in; if 1em is 16px, then pow(1em, 2) would give 1em, while pow(16px, 2) would give 256px, or 16em, which are very different values for what should otherwise be identical input arguments! [...]

First, expecting 1em as the result of pow(1em, 2) would be inconsistent with sign(1em) or abs(1em), which must wait for 1em to be resolved before evaluating their result:

Both of these functions operate on the fully simplified/resolved form of their arguments [...]

Or should sign() and abs() only work on numbers too?

Second, opacity: sqrt(100%) and color: lab(0 sqrt(100%) 0) are valid. But what is their resolved value? Or should pow() and sqrt() take calculations matching <number>?

edit: I realize the question also applies to trigonometric functions, exp(), log(), but I cannot think of a short title that would be appropriate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Closed as Question AnsweredUsed when the issue is more of a question than a problem, and it's been answered.css-values-4Current Work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions