@@ -1829,17 +1829,34 @@ Type Checking</h4>
1829
1829
If it can't [=CSSNumericValue/match=] any of these,
1830
1830
the [=math function=] is invalid.
1831
1831
1832
- As a further breaking change from the previous version of this specification,
1833
- division by zero is now allowed.
1834
- Implementations must follow IEEE-754 semantics for recognition and propagation
1835
- of infinities and NaN values,
1836
- including tracking the difference between +0 and -0.
1837
- (However, CSS treats both zeroes as the same,
1838
- if a [=math function=] resolves to one of them.)
1839
- Infinities are, by definition, out-of-range for any property,
1840
- and trigger appropriate clamping at used-value time per [[#calc-range]] .
1841
- If a [=math function=] would resolve to NaN,
1842
- it instead resolves to positive infinity.
1832
+ Division by zero is possible,
1833
+ which introduces certain complications.
1834
+ [=Math functions=] follow simplified versions of IEEE-754 semantics for these operations:
1835
+
1836
+ * Dividing a positive value by zero produces +∞.
1837
+ * Dividing a negative value by zero produces −∞.
1838
+ * Adding or subtracting ±∞ to anything produces the appropriate infinity,
1839
+ unless a following rule would define it as producing NaN.
1840
+ * Multiplying any value by ±∞ produces the appropriate infinity,
1841
+ unless a following rule would define it as producing NaN.
1842
+ * Dividing any value by ±∞ produces zero,
1843
+ unless a following rule would define it as producing NaN.
1844
+ * Dividing zero by zero,
1845
+ dividing ±∞ by ±∞,
1846
+ multiplying 0 by ±∞,
1847
+ adding +∞ to −∞
1848
+ (or the equivalent subtractions)
1849
+ produces NaN.
1850
+ * Any operation with at least one NaN argument produces NaN.
1851
+
1852
+ If a <dfn export>top-level calculations</dfn>
1853
+ (an argument to ''min()'' , ''max()'' , or ''clamp()'' ,
1854
+ or a ''calc()'' that's not nested directly inside of another [=math function=] )
1855
+ would produce a NaN,
1856
+ it instead produces +∞.
1857
+ Other calculations
1858
+ (such as a ''calc()'' nested directly within a [=math function=] )
1859
+ can produce NaN as normal.
1843
1860
1844
1861
Note: Algebraic simplifications do not affect the validity of a [=math function=] or its resolved type.
1845
1862
For example, ''calc(5px - 5px + 10s)'' and ''calc(0 * 5px + 10s)'' are both invalid
@@ -1956,6 +1973,15 @@ Range Checking</h4>
1956
1973
Note: This requires all contexts accepting ''calc()''
1957
1974
to define their allowable values as a closed (not open) interval.
1958
1975
1976
+ Note: By definition,
1977
+ ±∞ are outside the allowed range for any property,
1978
+ and will clamp to the minimum/maximum value allowed.
1979
+ Even for properties that explicitly allow ''infinity'' as a keyword value,
1980
+ such as 'animation-iteration-count' ,
1981
+ will end up clamping ±∞,
1982
+ as [=math functions=] can't resolve to keyword values;
1983
+ the <em> numeric</em> part of the property's syntax still has a minimum/maximum value.
1984
+
1959
1985
Additionally, if a [=math function=] that resolves to <<number>>
1960
1986
is used somewhere that only accepts <<integer>> ,
1961
1987
the [=computed value=] and [=used value=] are rounded to the nearest integer,
0 commit comments