Skip to content

Remove NaN tests for Ord and Eq #316

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

anttih
Copy link

@anttih anttih commented May 8, 2025

These tests rely on the purs inliner to provide correct behavior. With this change we leave the Ord and Eq NaN behavior undefined. A backend can choose how comparisons with NaN work.

Fixes #306

@garyb
Copy link
Member

garyb commented May 9, 2025

I don't know if this is right exactly, these NaN operations are part of IEEE-754 which we probably use to make other assumptions about numbers too.

@anttih
Copy link
Author

anttih commented May 10, 2025

@garyb Sure, but how do we solve #306? I thought it was agreed that we can consider NaN behavior as undefined for Ord, thus we could remove the tests. Do you have other suggestions?

@anttih
Copy link
Author

anttih commented May 10, 2025

I don't think we do other assumptions with regards to NaN. If we do, then we at least don't have tests for those.

@natefaubion
Copy link

While these are more problematic due to operator inlining, looks like there are some more Ord/Eq tests?

@anttih
Copy link
Author

anttih commented May 10, 2025

I've now removed all Ord and Eq tests for NaN.

@anttih anttih changed the title Remove NaN tests for Ord Remove NaN tests for Ord and Eq May 10, 2025
Copy link

@natefaubion natefaubion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@garyb Right now the instances/inlining situation is just incoherent. These tests aren't testing IEEE conformance so much as they are testing that the compiler inlines these operators. For example, use something other than prelude comparison operators, and these won't work!

I think if we have these tests anywhere they would need to be in the compiler with the JS backend because that's the only place this might make sense to validate.

@garyb
Copy link
Member

garyb commented May 11, 2025

Yeah, that's all fine, I'd completely forgotten about the previous discussion @anttih linked even though I participated. 😄

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

Successfully merging this pull request may close these issues.

ordNumber is not compatible with IEEE 754 floats
3 participants