Skip to content

[css-values-4] Round to integer only at end of computation or conversion #3444

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
TalbotG opened this issue Dec 16, 2018 · 2 comments
Closed
Labels

Comments

@TalbotG
Copy link
Collaborator

TalbotG commented Dec 16, 2018

In this
calc-integer.html
test authored by @emilio , at lines 44-46, we have:

specified: "calc(calc(1 / 3) * 3)",
computed: "1",
description: "Only rounds at the end of the conversion"

The statement "Only rounds at the end of the conversion" makes sense but I do not read a normative statement of this sort anywhere in the CSS4 Values specification.

5.1.1 Combination of <integer>

9.1 Mathematical Expressions: calc(), min(), max(), and clamp()

@astearns
Copy link
Member

@TalbotG by my reading the statement is in 9.1.4:

if a math function that resolves to <number> is used somewhere that only accepts <integer>, the computed value and used value are rounded to the nearest integer

The value of the interior calc in that test is not in a place that only accepts <integer>, so no rounding happens.

It would probably be good to have an example for this.

@TalbotG
Copy link
Collaborator Author

TalbotG commented Dec 17, 2018

Okay, I see. It's a tricky subtest.
I am closing this issue.

It would probably be good to have an example for this.

There are 2 sub-tests in @emilio test where a <number> is rounded to the nearest integer.

specified: "calc(1 / 2)",
computed: "1",
description: "Rounds up if fractional part is >= 0.5",

and

specified: "calc(1 / 3)",
computed: "0",
description: "Rounds down if fractional part is < 0.5",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants