Skip to content

Conversation

@tedgin
Copy link
Contributor

@tedgin tedgin commented Nov 6, 2025

getNaNPayload(x) returns a value even if x is not NaN, so it is up to the caller to verify that x is a NaN before calling getNaNPayload(x). This means it is not a good option for determining for determining which of a set of values has the largest NaN payload when it is only known that at least one value is NaN. cmp(x, y) can be used. since to orders -NaN as before -infinity and NaN as after infinity. When two NaN with the same sign are compared, the one with the larger payload is considered larger. This means that cmp(abs(x), abx(y)) will find the NaN with the larger payload when it is only known that at least one of x or y is NaN.

I apologize for so many merge requests. I didn't know until today that getNaNPayload would return something other than zero when called with a value that isn't NaN.

`getNaNPayload(x)` returns a value even if `x` is not NaN, so it is up to
the caller to verify that `x` is a NaN before calling `getNaNPayload(x)`.
This means it is not a good option for determining for determining which
of a set of values has the largest NaN payload when it is only known
that at least one value is NaN. `cmp(x, y)` can be used. since to orders
-NaN as before -infinity and NaN as after infinity. When two NaN with the
same sign are compared, the one with the larger payload is considered
larger. This means that `cmp(abs(x), abx(y))` will find the NaN with the
larger payload when it is only known that at least one of `x` or `y` is
NaN.
@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @tedgin! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "stable + phobos#10895"

@thewilsonator thewilsonator merged commit bcdaa07 into dlang:stable Nov 6, 2025
9 of 10 checks passed
@tedgin tedgin deleted the 10826 branch November 7, 2025 13:20
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.

3 participants