Skip to content
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

A reflexive version of the structural equality #6143

Closed
vicuna opened this issue Aug 28, 2013 · 2 comments
Closed

A reflexive version of the structural equality #6143

vicuna opened this issue Aug 28, 2013 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Aug 28, 2013

Original bug ID: 6143
Reporter: @alainfrisch
Status: closed (set by @xavierleroy on 2015-12-11T18:23:56Z)
Resolution: not a bug
Priority: normal
Severity: feature
Category: standard library

Bug description

Because of the IEEE 754 semantics, the generic structural equality is not a reflexive binary relation. In some cases, it would be useful to have access to a variant of this relation where 'x = x' holds for any x. There is some flexibility for the exact definition for 'nan' (all are 'nan' value equals, or do we compare the bits).

What about providing such a variant in Pervasives, implemented by passing an additional flag to the C implementation?

@vicuna
Copy link
Author

vicuna commented Aug 28, 2013

Comment author: @xavierleroy

Such a reflexive structural equality already exists: Pervasive.compare x y = 0. It compares all NaNs equal, and less than any other float value.

@vicuna
Copy link
Author

vicuna commented Aug 28, 2013

Comment author: @alainfrisch

Ah, thanks, I forgot about it! Would it make sense to expose it as an equality function (maybe an operator) as Pervasives?

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

No branches or pull requests

1 participant