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.
From https://drafts.csswg.org/css-values/#funcdef-tan,
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 saysFor the inverse functions:
So I guess this should round-trip and
tan(90deg)should be +∞ andtan(-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)returns16331239353195370because π/2 can't be stored exactly. But in CSS,degis the canonical unit for<angle>, and90is an integer, so I think there shouldn't be any precision problem.