W3C home > Mailing lists > Public > public-css-archive@w3.org > July 2019

[csswg-drafts] Does tan(90deg) return +∞, −∞ or NaN? (#4101)

From: Oriol Brufau via GitHub <sysbot+gh@w3.org>
Date: Wed, 10 Jul 2019 22:30:31 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-466554690-1562797830-sysbot+gh@w3.org>
Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts:

== Does tan(90deg) return +∞, −∞ or NaN? ==
From https://drafts.csswg.org/css-values/#funcdef-tan,

> `tan()` can return any number between +∞ and −∞.

But it's not clear to me what `tan(90deg)` is supposed to return. Mathematically, the limit from the left is +∞ and the limit from the right is −∞, so the limit doesn't exist. Does this mean NaN? But this case is not covered in https://drafts.csswg.org/css-values/#trig-infinities, which only says

> In `sin(A)`, `cos(A)`, or `tan(A)`, if A is infinite, the result is NaN.

For the inverse functions:

> In `atan(A)`, if A is +∞, the result is `90deg`; if A is -∞, the result is `-90deg`.

So I guess this should round-trip and `tan(90deg)` should be +∞ and `tan(-90deg)` be -∞?

ECMAScript doesn't define this case either, but I guess it can be handwaved due to floating-point precision problems, e.g. `Math.tan(Math.PI / 2)` returns `16331239353195370` because π/2 can't be stored exactly. But in CSS, `deg` is the canonical unit for `<angle>`, and `90` is an integer, so I think there shouldn't be any precision problem.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4101 using your GitHub account
Received on Wednesday, 10 July 2019 22:30:33 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:50 UTC