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

Consider allowing for different orderings (with some reasonable default). #7

Closed
olson-sean-k opened this issue Feb 11, 2018 · 2 comments

Comments

@olson-sean-k
Copy link
Owner

Decorum is opinionated about the total ordering it provides for floating-point values. Users cannot modify this behavior, and it is essentially hard-coded (see the canonical and constraint modules).

Maybe this should be parameterized via an additional type parameter. That parameter should have a default, and that default should probably use the "natural" ordering provided today (i.e., NaN and zero have single canonical forms). However, some users may want to use something more akin to the IEEE-754 ordering, where -NaN is less than -INF, NaN is greater than INF, and negative zero is less than zero (i.e., there is a distinction between negative and positive variants of NaN and zero).

I've seen some discussion about this regarding similar libraries, and I think alternative ordering may be useful for some applications.

@olson-sean-k
Copy link
Owner Author

Removing the 0.1.0 milestone. The practical use for this isn't entirely clear to me (I'm struggling to think of a compelling example). For 0.1.0, I think it's okay to omit such a feature. I'll leave this open for future consideration.

@olson-sean-k
Copy link
Owner Author

One of Decorum's primary features is a total ordering for floating-point types. The exact ordering isn't too important (NaN and its many representations are the main problem when it comes to ordering), and allowing multiple orderings to be used would likely cause more trouble then it's worth. I'm closing this for now, but it could be worth more discussion if a convincing use case comes along.

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