In Go I had a bug in a sort.Interface
implementation based on floating point divisions. This question's answers put me on the right track of finding my solution, but it did not answer my question directly: "How are float NaNs sorted [in Go]?"
Difficulties arose in finding the answer, because:
- This search did not return anything usefull: https://stackoverflow.com/search?q=%5Bgo%5D+sort+NaN
- The Go language spec states:
Floating-point values are comparable and ordered, as defined by the IEEE-754 standard.
- The IEEE-754 standard itself is behind a paywall. I don't consider it worth the investment, as I'm not writing the compiler here. I just want to know how
NaN
is handled in Go.
Finally I got to a reasonable explanation in the GNU libc documentation. It is not Go documentation, but after trying it out it does work the same and it solves my question.
My meta question:
I feel inclined of posting my findings somewhere on this site, sharing this info with others that might be facing the same problem. I'm thinking of the following possibilities:
- Post another answer, only with the subject of comparability.
- Post another answer and also explain my sorter problem in the answer to justify why I'm party crashing while the other answers already suffice for the question.
- Ask a new question plus answer.
My considerations at the moment:
- The answer might not directly answer the question, it is just related to it.
- Comparability is part of the answer to my question. The linked question helped me find the answer. Would this make the new question a duplicate?