Skip to content

[css-values] Should round(strategy, A, 0) be NaN or A? #4762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Loirooriol opened this issue Feb 8, 2020 · 6 comments
Closed

[css-values] Should round(strategy, A, 0) be NaN or A? #4762

Loirooriol opened this issue Feb 8, 2020 · 6 comments
Labels
Closed Accepted by Editor Discretion Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-values-4 Current Work

Comments

@Loirooriol
Copy link
Contributor

Currently https://drafts.csswg.org/css-values-4/#round-infinities says

In round(A, B), if B is 0, the result is NaN.

But according to @tabatkins "my aesthetic sense is telling me I'm not allowed to say it's NaN when there are clear limit values."

In this case the limit is clear: lim_{x→0} round(strategy, A, x) = A.
So maybe round(strategy, A, 0) should be A?

On the other hand, being A would seem to imply that A is a multiple of 0, which technically it's false.
But A / ∞ = 0, so in a sense we do have A ≈ 0 * ∞, dunno.

@Loirooriol Loirooriol added the css-values-4 Current Work label Feb 8, 2020
@Crissov
Copy link
Contributor

Crissov commented Feb 8, 2020

round(A, zero) should intuitively equal round(A) and thus A indeed.

@Loirooriol
Copy link
Contributor Author

@Crissov Note the spec doesn't allow round(A), and if it did I would expect it to be round(A, 1) (i.e. round to integer), not round(A, 0).

I don't have a strong opinion about round(A, 0) being A or NaN, but the choice doesn't seem obvious, so I filed this so that people can give some thought to it.

@tabatkins
Copy link
Member

Yeah, in this case the limit is different from the behavior at the limit, I think. The invariant that the result is a multiple of the step is broken.

But A / ∞ = 0, so in a sense we do have A ≈ 0 * ∞, dunno.

Note that 0 * infinity is NaN. ^_^

@Loirooriol
Copy link
Contributor Author

Sure, that's why I said "in a sense", i.e. it's one of the possible solutions of the indetermination, but there are others.

@tabatkins
Copy link
Member

I'm going to go ahead and close this no-change. I can see the limit argument for making round(A, 0) yield A, but the invariant argument for making it NaN (the result should be a multiple of the second argument, and nothing non-zero is a multiple of 0) still seems the most reasonable to me.

@Loirooriol, does this work for you?

@Loirooriol
Copy link
Contributor Author

Yes

@Loirooriol Loirooriol added Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. and removed Commenter Response Pending labels Oct 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed Accepted by Editor Discretion Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-values-4 Current Work
Projects
None yet
Development

No branches or pull requests

3 participants