[llvm] APFloat: Add minimumnum and maximumnum (PR #96304)

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 07:14:31 PDT 2024


================
@@ -1496,6 +1509,19 @@ inline APFloat maximum(const APFloat &A, const APFloat &B) {
   return A < B ? B : A;
 }
 
+/// Implements IEEE 754-2019 maximumNumber semantics. Returns the larger
+/// of 2 arguments, not propagating NaNs and treating -0 as less than +0.
+LLVM_READONLY
+inline APFloat maximumnum(const APFloat &A, const APFloat &B) {
+  if (A.isNaN())
+    return B.isNaN() ? B.makeQuiet() : B;
----------------
tschuett wrote:

Again is:
```
return B.makeQuiet();
```
sufficient?

https://github.com/llvm/llvm-project/pull/96304


More information about the llvm-commits mailing list