-
Notifications
You must be signed in to change notification settings - Fork 735
Description
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)
, ortan(A)
, if A is infinite, the result is NaN.
For the inverse functions:
In
atan(A)
, if A is +∞, the result is90deg
; 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.