docs: clarify that sqrt must be correctly rounded in accordance with IEEE 754#882
docs: clarify that sqrt must be correctly rounded in accordance with IEEE 754#882kgryte merged 5 commits intodata-apis:mainfrom
sqrt must be correctly rounded in accordance with IEEE 754#882Conversation
|
Given #826 (comment) says that the default for single-precision |
|
The default for single-precision divide in CUDA isn't to round with this precision either. |
|
I want to comment that
|
The default is to do correct rounding, as @hpkfft noted. However, it involves to not set array-api/src/array_api_stubs/_draft/elementwise_functions.py Lines 1478 to 1481 in 532db5b Therefore, I do not think the "correctly rounded" requirement is achievable. Certainly it is not CuPy's default. Ref: https://docs.nvidia.com/cuda/floating-point/index.html#compiler-flags |
|
Denormal result support (as opposed to flush to zero ( |
|
Oh, I think the note you referenced is not in the spec itself? But, I would suggest that your observation ought to be considered a separate bug/PR and not block this PR. |
|
Hi @hpkfft @kgryte, sorry for my late reply. I reached out to our math team (at NVIDIA) asking for clarification, and I believe what @hpkfft stated above is generally correct. Denormals can be flushed while still keeping the rounding behavior correct, at least for |
|
Thanks for the review @hpkfft! As the changes implement the suggestions discussed above, I'll go ahead and merge. Thanks all! |
|
Thanks to you both 🙏 |
This PR:
sqrtshould follow IEEE 754 and always return correctly rounded result. This was implied (i.e., conforming implementations should be IEEE 754 compliant), but never made explicit.