[llvm] [ConstantFolding] Constant fold nextafter and nexttoward (PR #168794)
Sayan Sivakumaran via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 23 10:00:22 PST 2025
================
@@ -0,0 +1,226 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
----------------
sivakusayan wrote:
Done. I realized that my previous implementation was incorrect, since it did `nextafter(-0.0, 0.0) = -0.0` and `nextafter(0.0,-0.0) = 0.0`. This is because I was returning the first operand when the operands are equal. However, the standard requires that we return the second operand when the operands are equal, casting to the return type if necessary.
The tests and the fix are committed.
https://github.com/llvm/llvm-project/pull/168794
More information about the llvm-commits
mailing list