Skip to content

Conversation

@cperkinsintel
Copy link
Contributor

Some users are wanting to reuse kernel code that contains std::nan("str"); declarations. At first I thought this impossible. But then...

…s. At first I thought this impossible. But then...
@cperkinsintel
Copy link
Contributor Author

The tests that are failing are failing because I've only done this stunt for the double nan. Not half or the other types yet.

constexpr double NanAbuse = std::numeric_limits<double>::quiet_NaN();
}

#define nan(x) NanAbuse
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's acceptable. NaN value must be as specified in the string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No two NaNs are ever equal. Even std::nan("1") and std::nan("1") so it doesn't matter what the value is, so long as it is NaN. In practice, supposedly some people can use the strings to disambiguate NaN values in the debugger, to help understand their provenance, but this is entirely outside the scope.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is always std::bit_cast...

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.

2 participants