[libcxx-commits] [libcxx] [libcxx] Use `lgamma` rather than `lgamma_r` with LLVM libc (PR #109556)

via libcxx-commits libcxx-commits at lists.llvm.org
Sat Sep 21 19:13:09 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Petr Hosek (petrhosek)

<details>
<summary>Changes</summary>

`lgamma_r` is currently only available on GPU targets.

---
Full diff: https://github.com/llvm/llvm-project/pull/109556.diff


1 Files Affected:

- (modified) libcxx/include/__random/binomial_distribution.h (+1-1) 


``````````diff
diff --git a/libcxx/include/__random/binomial_distribution.h b/libcxx/include/__random/binomial_distribution.h
index 3f19746bae238c..9538c15e2dc97b 100644
--- a/libcxx/include/__random/binomial_distribution.h
+++ b/libcxx/include/__random/binomial_distribution.h
@@ -103,7 +103,7 @@ extern "C" double lgamma_r(double, int*);
 #endif
 
 inline _LIBCPP_HIDE_FROM_ABI double __libcpp_lgamma(double __d) {
-#if defined(_LIBCPP_MSVCRT_LIKE)
+#if defined(_LIBCPP_MSVCRT_LIKE) || defined(__LLVM_LIBC__)
   return lgamma(__d);
 #else
   int __sign;

``````````

</details>


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


More information about the libcxx-commits mailing list