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

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

From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
Date: Fri, 12 Jul 2019 21:01:51 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-511032159-1562965309-sysbot+gh@w3.org>
Interesting question!

I agree that, at minimum, tan(90deg) should equal +inf. Since JS's Math.PI *slightly* undershoots the precise value, it happens to be true that `Math.tan(Math.PI/2 * N)` is always a very large (near infinite) positive value when N is a positive odd number, and a very large negative value when N is a negative odd. (But of course, adding a *very tiny* additional nudge will shift it over the threshold and swap the sign.) 

So at least it's consistent with *naive* usage of JS to say that positive angles give +inf and negative give -inf. ^_^ And then yeah, that gives you roundtripping of either nesting (within the [-90deg, 90deg] range).

GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4101#issuecomment-511032159 using your GitHub account
Received on Friday, 12 July 2019 21:01:52 UTC

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