[llvm] [libc][math] Implement double precision expm1 function correctly rounded for all rounding modes. (PR #67048)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 28 12:34:06 PDT 2023


================
@@ -0,0 +1,120 @@
+//===-- Unittests for e^x - 1 ---------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/expm1.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include "utils/MPFRWrapper/MPFRUtils.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+namespace mpfr = __llvm_libc::testing::mpfr;
+using __llvm_libc::testing::tlog;
+
+DECLARE_SPECIAL_CONSTANTS(double)
+
+TEST(LlvmLibcExpm1Test, TrickyInputs) {
+  constexpr int N = 21;
+  constexpr uint64_t INPUTS[N] = {
+      0x3FD79289C6E6A5C0,
+      0x3FD05DE80A173EA0, // 0x1.05de80a173eap-2
+      0xbf1eb7a4cb841fcc, // -0x1.eb7a4cb841fccp-14
+      0xbf19a61fb925970d,
----------------
lntue wrote:

Fixed.

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


More information about the llvm-commits mailing list