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

Clarification around returning -0.0 from certain builtins #1304

Open
frasercrmck opened this issue Jan 29, 2025 · 1 comment
Open

Clarification around returning -0.0 from certain builtins #1304

frasercrmck opened this issue Jan 29, 2025 · 1 comment

Comments

@frasercrmck
Copy link
Contributor

I was wondering if the specification could clarify whenever it says returns 0.0 whether this means strictly +0.0 or whether -0.0 is possible?

This appears to apply to the sign, step and smoothstep builtins but admittedly I only really have sign in mind. A more efficient implementation of sign may be possible in some cases if the sign was able to be copied directly from x, in which case negative NaNs would produce -0.0.

My interpretation of sign would be that it returns +0.0 but since the documentation goes out of its way to specify a return value of +0.0 and -0.0 when x is either of those values, leaving in 0.0 without an explicit sign as an option could be misinterpreted.

The OpenCL-CTS currently passes for an implementation of sign that returns -0.0 for -NaN. I don't know if those specific input values are being tested, but either way, if -0.0 is not intended then it is currently being allowed by omission.

@frasercrmck
Copy link
Contributor Author

Apologies, I meant to ask this over in OpenCL-Docs

@alycm alycm transferred this issue from KhronosGroup/OpenCL-CTS Jan 29, 2025
@alycm alycm reopened this Jan 29, 2025
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

No branches or pull requests

2 participants