@@ -2972,15 +2972,40 @@ Argument Ranges</h4>
29722972
29732973 (See [[#calc-type-checking]] for details on how [=math functions=] handle NaN and infinities.)
29742974
2975- Note: All of these behaviors are intended to match the "standard" definitions of these functions
2976- as implemented by most programming languages,
2977- in particular as implemented in JS.
2978-
2979- Issue: Per JS, hypot(∞, NaN) yields ∞, and pow(NaN, 0) yields 1.
2980- This violates the standard calculation rules of NaNs being fully infective.
2981- Do we want to carry that behavior over as well?
2982- Or maybe specifically undefine it,
2983- since it's just error behavior?
2975+ <div class=note>
2976+ All of these behaviors are intended to match the "standard" definitions of these functions
2977+ as implemented by most programming languages,
2978+ in particular as implemented in JS.
2979+
2980+ The only divergences from the behavior of the equivalent JS functions
2981+ are that NaN is "infectious" in <em> every</em> function,
2982+ forcing the function to return NaN if any argument calculation is NaN.
2983+
2984+ <details highlight=js>
2985+ <summary> Details of the JS Behavior</summary>
2986+
2987+ There are two cases in JS where a NaN is not "infectious"
2988+ to the math function it finds itself in:
2989+
2990+ * <code> Math.hypot(Infinity, NaN)</code> will return <code> Infinity</code> .
2991+ * <code> Math.pow(NaN, 0)</code> will return <code> 1</code> .
2992+
2993+ The logic appears to be that,
2994+ if you replace the NaN with <em> any</em> Number,
2995+ the return value will be the same.
2996+ However, this logic is not applied consistently to the <code> Math</code> functions:
2997+ <code> Math.max(Infinity, NaN)</code> returns <code> NaN</code> , not <code> Infinity</code> ;
2998+ the same is true of <code> Math.min(-Infinity, NaN)</code> .
2999+
3000+ Because this is an error corner case,
3001+ JS isn't consistent on the matter,
3002+ and NaN recognition/handling of [=calculations=]
3003+ is likely done at a higher CSS level
3004+ rather than in the internal math functions anyway,
3005+ consistency in CSS was chosen to be more important,
3006+ so all functions were defined to have "infection" NaN.
3007+ </details>
3008+ </div>
29843009
29853010
29863011<h3 id='calc-syntax'>
0 commit comments