@@ -3059,6 +3059,41 @@ Argument Ranges</h4>
3059
3059
</div>
3060
3060
3061
3061
3062
+ <h3 id='calc-signs'>
3063
+ Sign-Related Functions: ''abs()'', ''sign()''</h3>
3064
+
3065
+ The sign-related functions--
3066
+ ''abs()'' and ''sign()'' --
3067
+ compute various functions related to the sign of their argument.
3068
+
3069
+ The <dfn lt="abs()">abs(A)</dfn> function
3070
+ contains one [=calculation=] A,
3071
+ and returns the absolute value of A
3072
+ (if A is non-negative, just A;
3073
+ if A is negative, ''-1 * A'' )
3074
+ as the same [=CSSNumericValue/type=] as the input.
3075
+
3076
+ The <dfn lt="sign()">sign(A)</dfn> function
3077
+ contains one [=calculation=] A,
3078
+ and returns -1 if A is negative,
3079
+ +1 if A is positive,
3080
+ 0⁺ if A is 0⁺,
3081
+ and 0⁻ if A is 0⁻.
3082
+
3083
+ Note: Both of these functions operate on the fully simplified/resolved form of their arguments,
3084
+ which may give unintuitive results at first glance.
3085
+ In particular, an expression like ''10%''
3086
+ an expression like ''10%'' might be positive <em> or</em> negative once it's resolved,
3087
+ depending on what value it's resolved against.
3088
+ For example, in 'background-position' positive percentages
3089
+ resolve to a negative length,
3090
+ and vice versa,
3091
+ if the background image is larger than the background area.
3092
+ Thus ''sign(10%)'' might return ''1'' <em> or</em> ''-1'' ,
3093
+ depending on how the percentage is resolved!
3094
+ (Or even ''0'' , if it's resolved against a zero length.)
3095
+
3096
+
3062
3097
<h3 id='calc-syntax'>
3063
3098
Syntax</h3>
3064
3099
@@ -3081,6 +3116,8 @@ Syntax</h3>
3081
3116
<<hypot()>> = hypot( <<calc-sum>> # )
3082
3117
<<log()>> = log( <<calc-sum>> , <<calc-sum>> ? )
3083
3118
<<exp()>> = exp( <<calc-sum>> )
3119
+ <<abs()>> = abs( <<calc-sum>> )
3120
+ <<sign()>> = sign( <<calc-sum>> )
3084
3121
<dfn><calc-sum></dfn> = <<calc-product>> [ [ '+' | '-' ] <<calc-product>> ]*
3085
3122
<dfn><calc-product></dfn> = <<calc-value>> [ [ '*' | '/' ] <<calc-value>> ]*
3086
3123
<dfn><calc-value></dfn> = <<number>> | <<dimension>> | <<percentage>> | ( <<calc-sum>> )
0 commit comments