@@ -2472,13 +2472,13 @@ Trigonometric Functions: ''sin()'', ''cos()'', ''tan()'', ''asin()'', ''acos()''
2472
2472
''sin()'' , ''cos()'' , ''tan()'' , ''asin()'' , ''acos()'' , ''atan()'' , and ''atan2()'' --
2473
2473
compute the various basic trigonometric relationships.
2474
2474
2475
- The <dfn lt="sin()">sin(A)</dfn> , <dfn lt="cos(A )">cos()</dfn> , and <dfn lt="tan()">tan(A)</dfn> functions
2475
+ The <dfn lt="sin()">sin(A)</dfn> , <dfn lt="cos()">cos(A )</dfn> , and <dfn lt="tan()">tan(A)</dfn> functions
2476
2476
all contain a single [=calculation=]
2477
2477
which must resolve to either a <<number>>
2478
2478
or an <<angle>> ,
2479
2479
and compute their corresponding function
2480
2480
by interpreting the result of their argument as radians.
2481
- (That is, ''sin(45deg)'' , ''sin(.125 )'' , and ''sin(3.14159 / 4 * 1rad )''
2481
+ (That is, ''sin(45deg)'' , ''sin(.125turn )'' , and ''sin(3.14159 / 4)''
2482
2482
all represent the same value,
2483
2483
approximately ''.707'' .)
2484
2484
They all represent a <<number>> ;
@@ -2499,21 +2499,23 @@ Trigonometric Functions: ''sin()'', ''cos()'', ''tan()'', ''asin()'', ''acos()''
2499
2499
and the angle returned by ''atan()'' to the range [''-90deg'', ''90deg''] .
2500
2500
2501
2501
The <dfn lt="atan2()">atan2(A, B)</dfn> function
2502
- contains two comma-separated [=calculations=] A and B
2503
- that must resolve to <<number>> s,
2504
- and returns the <<angle>>
2502
+ contains two comma-separated [=calculations=] , A and B.
2503
+ A and B can resolve to any <<number>> , <<dimension>> , or <<percentage>> ,
2504
+ but must have the <em> same</em> [=determine the type of a calculation|type=] ,
2505
+ or else the function is invalid.
2506
+ The function returns the <<angle>>
2505
2507
between the positive X-axis and the point (B,A).
2506
2508
The returned angle must be normalized to the interval (''-180deg'' , ''180deg'' ]
2507
2509
(that is, greater than ''-180deg'' , and less than or equal to ''180deg'' ).
2508
2510
2509
2511
Note: ''atan2(Y, X)'' is <em> generally</em> equivalent to ''atan(Y / X)'' ,
2510
- but it gives a better answer when the point in question is in the second (NW) or third (SW) quadrants of the plane .
2511
- ''atan2(1, -1)'' , corresponding to the point (-1, 1) in the NW of the plane ,
2512
+ but it gives a better answer when the point in question may include negative components .
2513
+ ''atan2(1, -1)'' , corresponding to the point (-1, 1),
2512
2514
returns ''135deg'' ,
2513
- distinct from ''atan2(-1, 1)'' , corresponding to the point (1, -1) in the SE of the plane ,
2515
+ distinct from ''atan2(-1, 1)'' , corresponding to the point (1, -1),
2514
2516
which returns ''-45deg'' .
2515
- However, as '' 1 / -1'' and ''-1 / 1'' both resolve to ''-1 '' ,
2516
- ''atan()'' returns the same ''-45deg '' for both points .
2517
+ In contrast, ''atan( 1 / -1) '' and ''atan( -1 / 1) '' both return ''-45deg '' ,
2518
+ because the internal calculation resolves to ''-1 '' for both.
2517
2519
2518
2520
2519
2521
<h4 id="trig-infinities">
@@ -2603,6 +2605,7 @@ Exponential Functions: ''pow()'', ''sqrt()'', ''hypot()''</h3>
2603
2605
and then the ''pow(X, 1/3)'' would cube-root the value back down to 30 and multiply the exponent by 1/3,
2604
2606
giving «[ "length" → 1 ] »,
2605
2607
which [=CSSNumericValue/matches=] <<length>> .
2608
+
2606
2609
In the realm of pure mathematics, that's guaranteed to work out;
2607
2610
in the real-world of computers using binary floating-point arithmetic,
2608
2611
in some cases the powers might not exactly cancel out,
@@ -2652,7 +2655,8 @@ Exponential Functions: ''pow()'', ''sqrt()'', ''hypot()''</h3>
2652
2655
as the inputs and output all have the same type.
2653
2656
The result isn't unit-dependent, either,
2654
2657
due to the nature of the operation;
2655
- ''hypot(3em, 4em)'' and ''hypot(48px, 64px)'' give the same result in both cases:
2658
+ ''hypot(3em, 4em)'' and ''hypot(48px, 64px)'' both result in the same length
2659
+ when ''1em'' equals ''16px'' :
2656
2660
''5em'' or ''80px'' .
2657
2661
Thus it's fine to let author use dimensions directly in ''hypot()'' .
2658
2662
</details>
@@ -2986,14 +2990,14 @@ Computed Value</h3>
2986
2990
so implementations can simplify the expressions
2987
2991
further than what is required here
2988
2992
when storing the values internally;
2989
- in particular, all [=math function =] expressions can be reduced
2993
+ in particular, all [=calculation =] expressions can be reduced
2990
2994
to a sum of a <<number>> , a <<percentage>> , and some <<dimension>> s,
2991
2995
eliminating all multiplication or division,
2992
2996
and combining terms with identical units.
2993
2997
2994
2998
At this time, all units can be absolutized
2995
2999
to a single unit per type at computed-value time,
2996
- so at that point the [=math function =] can be reduced
3000
+ so at that point the [=calculation =] can be reduced
2997
3001
to just a <<number>> , a <<percentage>> , and a single absolute <<dimension>> of the appropriate type,
2998
3002
per expression.
2999
3003
</div>
0 commit comments