[libc-commits] [libc] [libc][math] Add scalbln{, f, l, f128} math functions (PR #102219)

via libc-commits libc-commits at lists.llvm.org
Wed Aug 7 15:22:06 PDT 2024


================
@@ -3618,6 +3619,51 @@ add_fp_unittest(
     libc.src.math.atan2
 )
 
+add_fp_unittest(
+  scalbln_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    scalbln_test.cpp
+  HDRS
+    ScalbnTest.h
+  DEPENDS
+    libc.src.math.scalbln
+    libc.src.__support.FPUtil.fp_bits
+    libc.src.__support.CPP.limits
+    libc.src.__support.FPUtil.normal_float
+)
----------------
overmighty wrote:

Nit: sorting. Same for the other changes below.

Here's a shell function I use to check sorting sometimes:

```sh
foo() { cat > /tmp/foo.txt; diff -u /tmp/foo.txt <(sort /tmp/foo.txt) }
```

Run `foo` (feel free to rename it), paste the dependencies or entrypoints or whatever, hit Enter, then hit Ctrl+D, and you'll get something like this:

```sh
~ ➜ foo() { cat > /tmp/foo.txt; diff -u /tmp/foo.txt <(sort /tmp/foo.txt) }
~ ➜ foo
    libc.src.math.scalbln
    libc.src.__support.FPUtil.fp_bits
    libc.src.__support.CPP.limits
    libc.src.__support.FPUtil.normal_float
--- /tmp/foo.txt	2024-08-08 00:19:32.174274463 +0200
+++ /proc/self/fd/11	2024-08-08 00:19:35.004294971 +0200
@@ -1,4 +1,4 @@
     libc.src.math.scalbln
-    libc.src.__support.FPUtil.fp_bits
     libc.src.__support.CPP.limits
+    libc.src.__support.FPUtil.fp_bits
     libc.src.__support.FPUtil.normal_float
~ ➜
```

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


More information about the libc-commits mailing list