You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[css-values-4] <angle> needs clamping details for degenerated values #6105
I'm currently implementing the infinity and NaN for 'calc()' function on chromium.
The step of implementation is now clamping to other components per each types e.g. <length>, <time> and etc.
Now I will work <angle> but the spec doesn't specify how to clamp for <angle> type for infinity and -infinity (also NaN).
According to the spec, the degenerated values must be clamped maximum and lowest values per the types.
However, I think if the <angle> is clamped to the maximum value (i.e., ≈3.35544e+0) seems like no make sense. Because the infinity degree is not specified how it looks like. (My minor opinion is the infinity degree is should look like 0 degrees)
Therefore, I think this might need a discussion about how to clamp 'infinity degree' and 'infinity rad' and so on.
changed the title [-][css-values-4] <angle> need clamping details for degenerated values[/-][+][css-values-4] <angle> needs clamping details for degenerated values[/+]on Mar 17, 2021
Probably need to clarify that the actual value of a dimension is clamped to the implementable range, and for angles in particular this limit must be a multiple of 360deg.
Treating infinity as zero wouldn't make sense because for something that e.g. rotates between 0deg and 2000deg, if the implementable limit were 1024deg (say), clamping the second value to zero wouldn't make sense.
That doesn't exist in the spec currently; we'd need to add it. I agree with it, tho - your intuition about treating it as 0deg was correct, it just needs to be equivalent to 0deg but with the correct distance from normal values.
Now I will work but the spec doesn't specify how to clamp for type for infinity and -infinity (also NaN).
Angles with NaN should be left as-is. This is depended on by some specifications. For example in CSS Color 4, NaN may be used for indeterminate hue angles (colors which are super close to the neutral axis).
And CSS Color 4 also defines interpolation between hue angles, when one is NaN.
Hmmmm, that's not workable per current spec; NaN only exists within a calculation and is censored otherwise (to infinity) as it escapes the calculation. If Color is currently depending on detecting a NaN that spec text will never fire.
I think what you want is that the hue is "missing", due to taking an achromatic color and interpolating it in a space with hue. Whether or not that ends up producing a hue angle of NaN when you run angle calculations in JS isn't necessarily relevant here.
Outside of that implicit missing-ness produced by converting between representations, a NaN angle is only produced by nonsensical calculations, and probably should be treated the same as an infinite angle.
Activity
DevSDK commentedon Mar 17, 2021
CC: @xiaochengh
[-][css-values-4] <angle> need clamping details for degenerated values[/-][+][css-values-4] <angle> needs clamping details for degenerated values[/+]fantasai commentedon Mar 17, 2021
Probably need to clarify that the actual value of a dimension is clamped to the implementable range, and for angles in particular this limit must be a multiple of 360deg.
Treating infinity as zero wouldn't make sense because for something that e.g. rotates between 0deg and 2000deg, if the implementable limit were 1024deg (say), clamping the second value to zero wouldn't make sense.
DevSDK commentedon Mar 17, 2021
Oh, thanks for the detailed comment :)
I see, zero is no make sense.
So, As I understood, the infinity degree should be the nearest multiple of 360deg from the maximum value. Am I correct?
Was it already existed in the spec or needed update?
tabatkins commentedon Mar 17, 2021
That doesn't exist in the spec currently; we'd need to add it. I agree with it, tho - your intuition about treating it as 0deg was correct, it just needs to be equivalent to 0deg but with the correct distance from normal values.
svgeesus commentedon Mar 17, 2021
Angles with
NaNshould be left as-is. This is depended on by some specifications. For example in CSS Color 4,NaNmay be used for indeterminate hue angles (colors which are super close to the neutral axis).And CSS Color 4 also defines interpolation between hue angles, when one is
NaN.tabatkins commentedon Mar 17, 2021
Hmmmm, that's not workable per current spec;
NaNonly exists within a calculation and is censored otherwise (toinfinity) as it escapes the calculation. If Color is currently depending on detecting aNaNthat spec text will never fire.I think what you want is that the hue is "missing", due to taking an achromatic color and interpolating it in a space with hue. Whether or not that ends up producing a hue angle of
NaNwhen you run angle calculations in JS isn't necessarily relevant here.Outside of that implicit missing-ness produced by converting between representations, a
NaNangle is only produced by nonsensical calculations, and probably should be treated the same as an infinite angle.xiaochengh commentedon Mar 18, 2021
If I understand correctly, #6107 is a separate non-blocking issue, and this one only needs some spec edits?
tabatkins commentedon Mar 19, 2021
Yep.
[css-values-4] Specify that <angle>s must clamp to a multiple of 360d…
Clamp degenerate calc() values for <angle>