[csswg-drafts] [css-values] Are sqrt(X) and pow(X, .5) equivalent for −∞? (#4157)

Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-values] Are sqrt(X) and pow(X, .5) equivalent for −∞? ==
From https://drafts.csswg.org/css-values/#funcdef-sqrt

> `sqrt(X)` and `pow(X, .5)` are equivalent; `sqrt()` is a common enough function that it is provided as a convenience.

According to https://drafts.csswg.org/css-values/#exponent-infinities,

> In `sqrt(A)`, if A is +∞, the result is +∞. If A is less than 0, the result is NaN.
> In `pow(A, B)`, if A is negative, B must be an integer, or else the result is NaN.

so it seems both `sqrt(−∞)` and `pow(−∞, 0.5)` should be NaN.

But there is also a table for infinity values which says that `pow(−∞, 0.5)` should be +∞.

> A is -∞, B is > 0: result is -∞ if B is an odd integer, +∞ otherwise 

And there is this note:

> All of these behaviors are intended to match the "standard" definitions of these functions as implemented by most programming languages, in particular as implemented in JS.

But `sqrt(X)` and `pow(X, .5)` are not equivalent in JS:

```js
Math.pow(-Infinity, 0.5) // +Infinity
Math.sqrt(-Infinity) // NaN
```


Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4157 using your GitHub account

Received on Monday, 29 July 2019 16:59:39 UTC