[clang] [Clang] Add constexpr eval for cmath builtins (PR #194327)

via cfe-commits cfe-commits at lists.llvm.org
Fri May 8 07:20:44 PDT 2026


================
@@ -0,0 +1,270 @@
+// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify -std=c++20 %s
+// RUN: %clang_cc1 -verify -std=c++20 %s
+
+
+
+static_assert(__builtin_nearbyint(1.1) == 1.0);
+static_assert(__builtin_nearbyint(1.9) == 2.0);
+static_assert(__builtin_nearbyint(-1.1) == -1.0);
+static_assert(__builtin_nearbyint(-1.9) == -2.0);
+
+static_assert(__builtin_nearbyintf(1.1f) == 1.0f);
----------------
Serosh-commits wrote:

done added the tests thanks 

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


More information about the cfe-commits mailing list