[llvm] APFloat: Add minimumnum and maximumnum (PR #96304)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 21 07:11:49 PDT 2024
================
@@ -1483,6 +1483,19 @@ inline APFloat minimum(const APFloat &A, const APFloat &B) {
return B < A ? B : A;
}
+/// Implements IEEE 754-2019 minimumNumber semantics. Returns the smaller
+/// of 2 arguments, not propagating NaNs and treating -0 as less than +0.
+LLVM_READONLY
+inline APFloat minimumnum(const APFloat &A, const APFloat &B) {
+ if (A.isNaN())
+ return B.isNaN() ? B.makeQuiet() : B;
----------------
arsenm wrote:
Yes. It's merely suggested you should try to preserve one of the payloads. You're also allowed to just lose the payload
https://github.com/llvm/llvm-project/pull/96304
More information about the llvm-commits
mailing list