Content-Length: 412957 | pFad | http://github.com/w3c/csswg-drafts/commit/328ddb3f28fc38436044b1739b95c4640ee62643

E0 [css-values-4] Undefine the value of tan() at the asymptotes. #8527 · w3c/csswg-drafts@328ddb3 · GitHub
Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 328ddb3

Browse files
committedApr 6, 2023
[css-values-4] Undefine the value of tan() at the asymptotes. #8527
1 parent f5dffeb commit 328ddb3

File tree

1 file changed

+49
-21
lines changed

1 file changed

+49
-21
lines changed
 

‎css-values-4/Overview.bs

Lines changed: 49 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3425,17 +3425,55 @@ Argument Ranges</h4>
34253425

34263426
In ''tan(A)'', if A is one of the asymptote values
34273427
(such as ''90deg'', ''270deg'', etc),
3428-
the result must be +∞ for ''90deg'' and all values a multiple of ''360deg'' from that
3429-
(such as ''-270deg'' or ''450deg''),
3430-
and −∞ for ''-90deg'' and all values a multiple of ''360deg'' from that
3431-
(such as ''-450deg'' or ''270deg'').
3432-
3433-
Note: This is only relevant for units that can exactly represent the asymptotic values,
3434-
such as ''deg'' or ''grad''.
3435-
''rad'' cannot,
3436-
and so whether the result is a very large negative or positive value
3437-
can depend on rounding and precise details of how numbers are internally stored.
3438-
It's recommended you don't depend on this behavior if using such units.
3428+
the result is <strong>explicitly undefined</strong>.
3429+
If an implementation is capable of exactly representing these inputs,
3430+
it <em>should</em> return
3431+
+∞ for the asymptotes at <code>90deg + N*360deg</code>,
3432+
and −∞ for the asymptotes at <code>-90deg + N*360deg</code>,
3433+
but implementations are not required to be able to exactly represent these inputs
3434+
(and if they can't, will return whatever the correct numeric answer is
3435+
for the closest approximation to the input
3436+
they are capable of representing).
3437+
Authors <em>must not</em> rely on ''tan()'' returning any particular value
3438+
for these inputs.
3439+
3440+
<details class=note>
3441+
<summary>Why are these undefined?</summary>
3442+
3443+
The tangent function is <em>discontinuous</em> at its asymptotes:
3444+
it approaches infinity from one side
3445+
<em>and</em> negative infinity from the other side,
3446+
and isn't defined at the exact values of the asymptote.
3447+
3448+
Further, whether or not the asymptotic values
3449+
are exactly representable in implementations
3450+
depends on how they internally store and manipulate angles;
3451+
when written in degrees the values are simple (''90deg'', etc),
3452+
but in radians the values are transcendental (''pi / 2'', etc)
3453+
and cannot be exactly represented.
3454+
So, even defining a specific behavior for these values is difficult;
3455+
if an implementation uses radians internally,
3456+
it would have to do some fuzzy matching
3457+
to return the defined value
3458+
when the input is <em>sufficiently close</em> to the asymptote.
3459+
3460+
The other major language for the Web, JavaScript,
3461+
exposes these functions as taking radians only,
3462+
so it can't hit the exact asymptotes either
3463+
(and this true for most other computer languages, too).
3464+
Authors writing code in JS, then,
3465+
can't rely on any specific behavior for these values either,
3466+
and it's unlikely that their needs in CSS are significantly different.
3467+
3468+
The suggested behavior for implementations that can exactly represent the asymptote values
3469+
preserves round-tripping with the ''atan()'' function:
3470+
''tan(atan(X))'' and ''atan(tan(X))''
3471+
will both return (approximately) X
3472+
for all possible X values,
3473+
given this definition.
3474+
It also means that within the supported output range of ''atan()'',
3475+
the function is continuous.
3476+
</details>
34393477

34403478
In ''asin(A)'' or ''acos(A)'',
34413479
if A is less than -1 or greater than 1,
@@ -3518,16 +3556,6 @@ Argument Ranges</h4>
35183556
as implemented by most programming languages,
35193557
in particular as implemented in JS.
35203558

3521-
Note: The behavior of ''tan(90deg)'',
3522-
while not constrained by JS behavior
3523-
(because the JS function's input is in radians,
3524-
and one cannot perfectly express a value of π/2 in JS numbers),
3525-
is defined so that roundtripping of values works;
3526-
''tan(atan(infinity))'' yields +∞,
3527-
''tan(atan(-infinity))'' yields −∞,
3528-
''atan(tan(90deg))'' yields ''90deg'',
3529-
and ''atan(tan(-90deg))'' yields ''-90deg''.
3530-
35313559

35323560
<h3 id=exponent-funcs>
35333561
Exponential Functions: ''pow()'', ''sqrt()'', ''hypot()'', ''log()'', ''exp()''</h3>

0 commit comments

Comments
 (0)
Failed to load comments.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/w3c/csswg-drafts/commit/328ddb3f28fc38436044b1739b95c4640ee62643

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy