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

cmp: document ordering for floating point values in cmp.Ordered #60648

Closed
robpike opened this issue Jun 6, 2023 · 4 comments
Closed

cmp: document ordering for floating point values in cmp.Ordered #60648

robpike opened this issue Jun 6, 2023 · 4 comments
Labels
Documentation NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@robpike
Copy link
Contributor

robpike commented Jun 6, 2023

Although the information is scattered about elsewhere, it would be good for the documentation for cmp.Ordered to explain how NaNs work. Then, the documentation for builtin.min and builtin.max should reference the documentation for cmp.Ordered directly (it does indirectly through the declaration).

@ianlancetaylor
Copy link
Contributor

Although cmp.Ordered doesn't say anything about NaNs, we do document NaN behavior for both cmp.Compare and cmp.Less. The spec documents NaN behavior for min and max (https://tip.golang.org/ref/spec#Min_and_max), though I guess we don't currently say anything in the builtin package docs.

@robpike
Copy link
Contributor Author

robpike commented Jun 7, 2023

It's fine if they all cross-reference one another, but it should also be documented in the libraries as well as the spec. I would be unlikely to think of going to the spec to read how cmp.Ordered works, for example.

@dr2chase
Copy link
Contributor

dr2chase commented Jun 9, 2023

@rsc @ianlancetaylor do we plan to get this done for 1.21?

@gopherbot
Copy link

Change https://go.dev/cl/502235 mentions this issue: cmp, builtin: document NaN behavior

@dmitshur dmitshur added this to the Go1.21 milestone Jun 10, 2023
@dmitshur dmitshur added the NeedsFix The path to resolution is known, but the work has not been done. label Jun 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants