[libc-commits] [libc] [libc] sqrt and log functions fuzz tests (PR #148006)
via libc-commits
libc-commits at lists.llvm.org
Thu Jul 10 20:07:13 PDT 2025
================
@@ -0,0 +1,38 @@
+//===-- log1p_fuzz.cpp ----------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// Fuzzing test for llvm-libc log1p implementation.
+///
+//===----------------------------------------------------------------------===//
+
+#include "src/math/log1p.h"
+#include "utils/MPFRWrapper/mpfr_inc.h"
+#include <math.h>
+
+extern "C" int LLVMFuzzerTestOneInput(double x) {
+ // remove NaN and inf and values outside accepted range
+ if (isnan(x) || isinf(x) || x < 0)
----------------
lntue wrote:
`log1p(x)` meaningful range is `x >= -1`
https://github.com/llvm/llvm-project/pull/148006
More information about the libc-commits
mailing list