Skip to content

Commit 75609de

Browse files
committed
Define required precision, and split up ranges by type. Put it all into an appendix. Define rounding behavior of computed values.
1 parent d71a480 commit 75609de

3 files changed

Lines changed: 202 additions & 27 deletions

File tree

css3-values/Overview.html

Lines changed: 106 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
dt + dt::before { content: ", "; }
1616
dt { display: inline; }
1717
:not(code) var { font-style: normal; color: #005A9C; }
18+
td > small { display: block; }
1819
</style>
1920
<link href="../default.css" rel=stylesheet type="text/css">
2021
<link href="http://www.w3.org/StyleSheets/TR/W3C-ED.css" rel=stylesheet
@@ -27,13 +28,13 @@
2728

2829
<h1>CSS Values and Units Module Level 3</h1>
2930

30-
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 22 May 2012</h2>
31+
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 23 May 2012</h2>
3132

3233
<dl>
3334
<dt>This version:
3435

3536
<dd><a
36-
href="http://www.w3.org/TR/2012/ED-css3-values-20120522/">http://www.w3.org/TR/2012/ED-css3-values-20120522/</a>
37+
href="http://www.w3.org/TR/2012/ED-css3-values-20120523/">http://www.w3.org/TR/2012/ED-css3-values-20120523/</a>
3738

3839
<dt>Latest version:
3940

@@ -297,9 +298,12 @@ <h2 class="no-num no-toc" id=contents>Table of contents</h2>
297298
References: ‘<code class=css>attr()</code></a>
298299
</ul>
299300

301+
<li><a href="#required-ranges"><span class=secno>9. </span> Appendix A:
302+
Recommended Minimum Ranges and Precision of Computed Values</a>
303+
300304
<li class=no-num><a href="#acknowledgments">Acknowledgments</a>
301305

302-
<li><a href="#conformance"><span class=secno>9. </span> Conformance</a>
306+
<li class=no-num><a href="#conformance"> Conformance</a>
303307
<ul class=toc>
304308
<li><a href="#conventions"><span class=secno>9.1. </span> Document
305309
conventions</a>
@@ -747,16 +751,13 @@ <h2 id=numeric-types><span class=secno>4. </span> Numeric Data Types</h2>
747751

748752
<p> Properties may restrict numeric values to some range. If the value is
749753
outside the allowed range, the declaration is invalid and must be <a
750-
href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>. For
751-
unrestricted values, UAs must support at least up to ±2<sup>24</sup>-1;
752-
unsupported values must be clamped to the closest supported value. When
753-
arithmetic is performed with numeric types (for example, in the calc()
754-
expression, or when doing unit conversions), if the result is outside the
755-
UAs's supported range, it must also be clamped to the closest supported
756-
value.
754+
href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>.
757755

758-
<p> UAs must support at least 3 digits of precision after the decimal point
759-
in numeric values.
756+
<p> CSS theoretically supports infinite precision and infinite ranges for
757+
all value types; however in reality implementations have finite capacity.
758+
The recommended minimum ranges and precision, and the required rounding
759+
and clamping rules, are given in <a href="#required-ranges">Appendix
760+
A</a>.
760761

761762
<h3 id=integers><span class=secno>4.1. </span> Integers: the ‘<a
762763
href="#integer-value"><code class=css>&lt;integer></code></a>’ type</h3>
@@ -1890,13 +1891,105 @@ <h3 id=attr-notation><span class=secno>8.3. </span> Attribute References:
18901891
versions of CSS may extend ‘<a href="#attr"><code
18911892
class=css>attr()</code></a>’ in this direction.
18921893

1894+
<h2 id=required-ranges><span class=secno>9. </span> Appendix A: Recommended
1895+
Minimum Ranges and Precision of Computed Values</h2>
1896+
1897+
<p> For unrestricted values, the recommended minimum range and precision of
1898+
computed values is given in the table below.
1899+
1900+
<table class=data>
1901+
<thead>
1902+
<tr>
1903+
<th>Type
1904+
1905+
<th>Recommended Minimum Precision
1906+
1907+
<th>Recommended Minimum Maximum (Absolute Value)
1908+
1909+
<tbody>
1910+
<tr>
1911+
<th><a href="#integer-value"><var>&lt;integer></var></a>
1912+
1913+
<td>1
1914+
1915+
<td>2<sup>24</sup>−1
1916+
1917+
<tr>
1918+
<th><a href="#number-value"><var>&lt;number></var></a>
1919+
1920+
<td>0.01 <small>(within the range -100 &lt; <var>x</var> &lt;
1921+
100)</small>
1922+
1923+
<td>2<sup>17</sup>−1
1924+
1925+
<tr>
1926+
<th><a href="#percentage-value"><var>&lt;percentage></var></a>
1927+
1928+
<td>0.01% <small>(within the range -100 &lt; <var>x</var> &lt;
1929+
100)</small>
1930+
1931+
<td>(2<sup>17</sup>−1)%
1932+
1933+
<tr>
1934+
<th><a href="#length-value"><var>&lt;length></var></a>
1935+
1936+
<td>0.1px
1937+
1938+
<td>(2<sup>24</sup>−1)px
1939+
1940+
<tr>
1941+
<th><a href="#angle-value"><var>&lt;angle></var></a>
1942+
1943+
<td>0.1deg
1944+
1945+
<td>(2<sup>24</sup>−1)deg
1946+
1947+
<tr>
1948+
<th><a href="#time-value"><var>&lt;time></var></a>
1949+
1950+
<td>1ms
1951+
1952+
<td>(2<sup>24</sup>−1)ms
1953+
1954+
<tr>
1955+
<th><a href="#frequency-value"><var>&lt;frequency></var></a>
1956+
1957+
<td>0.01Hz
1958+
1959+
<td>(2<sup>17</sup>−1)Hz
1960+
</table>
1961+
1962+
<p> Values outside the supported range must be clamped into the supported
1963+
range. Values specified with an unsupported amount of precision must be
1964+
rounded to the closest supported value; except that values that are not
1965+
equal to, but would round to, either zero or the boundary of a closed
1966+
range, are rounded away from that value rather than to it.
1967+
1968+
<div class=example>
1969+
<p> For example, in a UA that only supports a precision of 0.01, an
1970+
<code class=property>opacity</code>’ value of ‘<code
1971+
class=css>0.9999</code>’ would round to ‘<code
1972+
class=css>0.99</code>’, not ‘<code class=css>1.0</code>’, and would
1973+
therefore cause the element to create a stacking context. Similarly, a
1974+
<code class=css>flex-grow</code>’ value of ‘<code
1975+
class=css>0.001</code>’ would round to ‘<code
1976+
class=css>0.01</code>’, not ‘<code class=css>0</code>’, and would
1977+
therefore be flexible.
1978+
</div>
1979+
1980+
<p> When arithmetic is performed with numeric types (for example, in the
1981+
<a href="#calc"><code class=css>calc()</code></a>’ expression), if
1982+
the result is unsupported it must also be clamped/rounded as necessary.
1983+
<span class=note> Note this means that rounding errors <em>may</em>
1984+
accumulate. </span>
1985+
18931986
<h2 class=no-num id=acknowledgments>Acknowledgments</h2>
18941987

18951988
<p>Comments and suggestions from Giovanni Campagna, Christoph Päper, Keith
18961989
Rarick, Alex Mogilevsky, Ian Hickson, David Baron, Edward Welbourne, Boris
18971990
Zbarsky, Björn Höhrmann and Michael Day improved this module.
18981991

1899-
<h2 id=conformance><span class=secno>9. </span> Conformance</h2>
1992+
<h2 class=no-num id=conformance> Conformance</h2>
19001993

19011994
<h3 id=conventions><span class=secno>9.1. </span> Document conventions</h3>
19021995

css3-values/Overview.src.html

Lines changed: 72 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
dt + dt::before { content: ", "; }
1515
dt { display: inline; }
1616
:not(code) var { font-style: normal; color: #005A9C; }
17+
td > small { display: block; }
1718
</style>
1819
<link rel="stylesheet" type="text/css" href="../default.css">
1920
<link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-[STATUS].css">
@@ -424,15 +425,12 @@ <h2 id="numeric-types">
424425
Properties may restrict numeric values to some range.
425426
If the value is outside the allowed range,
426427
the declaration is invalid and must be <a href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>.
427-
For unrestricted values, UAs must support at least up to ±2<sup>24</sup>-1;
428-
unsupported values must be clamped to the closest supported value.
429-
When arithmetic is performed with numeric types
430-
(for example, in the calc() expression, or when doing unit conversions),
431-
if the result is outside the UAs's supported range,
432-
it must also be clamped to the closest supported value.
433-
434428
<p>
435-
UAs must support at least 3 digits of precision after the decimal point in numeric values.
429+
CSS theoretically supports infinite precision and infinite ranges for all value types;
430+
however in reality implementations have finite capacity.
431+
The recommended minimum ranges and precision,
432+
and the required rounding and clamping rules,
433+
are given in <a href="#required-ranges">Appendix A</a>.
436434

437435
<h3 id="integers">
438436
Integers: the ''&lt;integer>'' type</h3>
@@ -1413,12 +1411,77 @@ <h3 id="attr-notation">
14131411
another attribute. Future versions of CSS may extend ''attr()'' in this
14141412
direction.</p>
14151413

1414+
<h2 id="required-ranges">
1415+
Appendix A: Recommended Minimum Ranges and Precision of Computed Values</h2>
1416+
1417+
<p>
1418+
For unrestricted values, the recommended minimum range and precision
1419+
of computed values
1420+
is given in the table below.
1421+
1422+
<table class="data">
1423+
<thead>
1424+
<tr><th>Type
1425+
<th>Recommended Minimum Precision
1426+
<th>Recommended Minimum Maximum (Absolute Value)
1427+
</thead>
1428+
<tbody>
1429+
<tr><th><var>&lt;integer></var>
1430+
<td>1
1431+
<td>2<sup>24</sup>&minus;1
1432+
<tr><th><var>&lt;number></var>
1433+
<td>0.01
1434+
<small>(within the range -100 &lt; <var>x</var> &lt; 100)</small>
1435+
<td>2<sup>17</sup>&minus;1
1436+
<tr><th><var>&lt;percentage></var>
1437+
<td>0.01%
1438+
<small>(within the range -100 &lt; <var>x</var> &lt; 100)</small>
1439+
<td>(2<sup>17</sup>&minus;1)%
1440+
<tr><th><var>&lt;length></var>
1441+
<td>0.1px
1442+
<td>(2<sup>24</sup>&minus;1)px
1443+
<tr><th><var>&lt;angle></var>
1444+
<td>0.1deg
1445+
<td>(2<sup>24</sup>&minus;1)deg
1446+
<tr><th><var>&lt;time></var>
1447+
<td>1ms
1448+
<td>(2<sup>24</sup>&minus;1)ms
1449+
<tr><th><var>&lt;frequency></var>
1450+
<td>0.01Hz
1451+
<td>(2<sup>17</sup>&minus;1)Hz
1452+
</tbody>
1453+
</table>
1454+
1455+
<p>
1456+
Values outside the supported range must be clamped into the supported range.
1457+
Values specified with an unsupported amount of precision must be rounded
1458+
to the closest supported value;
1459+
except that values that are not equal to, but would round to,
1460+
either zero or the boundary of a closed range,
1461+
are rounded away from that value rather than to it.
1462+
1463+
<div class="example">
1464+
<p>
1465+
For example, in a UA that only supports a precision of 0.01,
1466+
an 'opacity' value of ''0.9999'' would round to ''0.99'', not ''1.0'',
1467+
and would therefore cause the element to create a stacking context.
1468+
Similarly, a ''flex-grow'' value of ''0.001'' would round to ''0.01'',
1469+
not ''0'', and would therefore be flexible.
1470+
</div>
1471+
1472+
<p>
1473+
When arithmetic is performed with numeric types
1474+
(for example, in the ''calc()'' expression),
1475+
if the result is unsupported
1476+
it must also be clamped/rounded as necessary.
1477+
<span class="note">
1478+
Note this means that rounding errors <em>may</em> accumulate.
14161479

14171480
<h2 class="no-num" id="acknowledgments">Acknowledgments</h2>
14181481

14191482
<p>Comments and suggestions from Giovanni Campagna, Christoph P&auml;per, Keith Rarick, Alex Mogilevsky, Ian Hickson, David Baron, Edward Welbourne, Boris Zbarsky, Bj&ouml;rn H&ouml;hrmann and Michael Day improved this module.
14201483

1421-
<h2 id="conformance">
1484+
<h2 class="no-num" id="conformance">
14221485
Conformance</h2>
14231486

14241487
<h3 id="conventions">

css3-values/issues-lc-2012.txt

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,22 +134,22 @@ Summary: Several grammar nits around numbers
134134
From: Kenny Lu
135135
Comment: http://lists.w3.org/Archives/Public/www-style/2012Apr/0080.html
136136
Response: http://lists.w3.org/Archives/Public/www-style/2012Apr/0631.html
137-
Open: Exact spec edits depend on a 2.1 issue resolution.
137+
Closed: Mostly accepted
138138
----
139139
Issue 21.
140140
Summary: attr() and cycle() must be "valid where they are placed", but can resolve as multiple types
141141
From: Kenny Lu
142142
Comment: http://lists.w3.org/Archives/Public/www-style/2012Apr/0151.html
143143
Response: http://lists.w3.org/Archives/Public/www-style/2012Apr/0626.html
144-
Open: Accepted pending WG resolution
144+
Closed: Accepted
145145
----
146146
Issue 22.
147147
Summary: Required ranges for all the values seem random or incorrect
148148
From: Kenny Lu
149149
Comment: http://lists.w3.org/Archives/Public/www-style/2012Apr/0403.html
150150
Response: http://lists.w3.org/Archives/Public/www-style/2012Apr/0633.html
151151
Comment: http://lists.w3.org/Archives/Public/www-style/2012Apr/0530.html
152-
Open: Accepted pending WG resolution
152+
Open: Accepted
153153
----
154154
Issue 23.
155155
Summary: When does clamping happen in calc()?
@@ -163,13 +163,13 @@ Summary: Parsing of attribute values is ambiguous.
163163
From: Kenny Lu
164164
Comment: http://lists.w3.org/Archives/Public/www-style/2012Apr/0405.html
165165
Response: http://lists.w3.org/Archives/Public/www-style/2012Apr/0416.html
166-
Open: Accepted pending WG resolution
166+
Open: Accepted
167167
----
168168
Issue 25.
169169
Summary: Define "required precision" for numbers.
170170
From: Arron Eicholz
171171
Comment: (private comment)
172-
Open: Accepted pending WG resolution
172+
Open: Accepted pending proposal + WG resolution
173173
Note: Made a required precision of 3 decimal digits.
174174
----
175175
Issue 26.
@@ -187,3 +187,22 @@ Comment: http://lists.w3.org/Archives/Public/www-style/2012Apr/0566.html
187187
Response:
188188
Closed: Deferred
189189
----
190+
Issue 28.
191+
Summary: Define normalization handling of <author-ident>
192+
From: fantasai
193+
Comment: http://lists.w3.org/Archives/Public/www-style/2012May/0026.html
194+
Response:
195+
Open
196+
----
197+
Issue 29.
198+
Summary: Case-sensitivity of <author-ident>
199+
From: fantasai + Tab Atkins
200+
Comment: http://lists.w3.org/Archives/Public/www-style/2012May/0499.html
201+
Open
202+
----
203+
Issue 30.
204+
Summary: Add <positive-integer> and <non-negative-integer> types
205+
From: Brian Manthos
206+
Comment: http://lists.w3.org/Archives/Public/www-style/2012May/0343.html
207+
Closed: Deferred
208+
----

0 commit comments

Comments
 (0)