Skip to content

[css-values-4] Nit: comparing -0 and +0 in min() and max() #9631

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
cdoublev opened this issue Nov 23, 2023 · 3 comments
Closed

[css-values-4] Nit: comparing -0 and +0 in min() and max() #9631

cdoublev opened this issue Nov 23, 2023 · 3 comments
Labels
Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. css-values-4 Current Work

Comments

@cdoublev
Copy link
Collaborator

1 / max(-1 * 0, 1 * 0) results to -infinity in Chrome/FF. Similarly, 1 / min(1 * 0, -1 * 0) results to infinity.

They do not consider -0 < 0 to be true, like in the JS comparison, and returns the first argument. But in JS, 1 / Math.max(-1 * 0, 1 * 0) results to Infinity and 1 / Math.min(1 * 0, -1 * 0) results to -Infinity.

There is no related WPT test. Can you please tell me what is the expected result?

@cdoublev cdoublev added the css-values-4 Current Work label Nov 23, 2023
@Loirooriol
Copy link
Contributor

https://drafts.csswg.org/css-values-4/#calc-ieee

When comparing 0⁺ and 0⁻, 0⁻ is less than 0⁺. For example, min(0⁺, 0⁻) must produce 0⁻, max(0⁺, 0⁻) must produce 0⁺, and clamp(0⁺, 0⁻, 1) must produce 0⁺.

@cdoublev
Copy link
Collaborator Author

Ah, I missed it, sorry. Thanks Oriol.

@Loirooriol Loirooriol added the Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. label Nov 28, 2023
@Loirooriol
Copy link
Contributor

web-platform-tests/wpt#43430

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. css-values-4 Current Work
Projects
None yet
Development

No branches or pull requests

2 participants