| 723 | // or that there is no suitable std::log1p function available |
| 724 | template<typename Scalar> |
| 725 | EIGEN_DEVICE_FUNC inline Scalar log1p(const Scalar& x) { |
| 726 | EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) |
| 727 | typedef typename NumTraits<Scalar>::Real RealScalar; |
| 728 | EIGEN_USING_STD(log); |
| 729 | Scalar x1p = RealScalar(1) + x; |
| 730 | Scalar log_1p = log_impl<Scalar>::run(x1p); |
| 731 | const bool is_small = numext::equal_strict(x1p, Scalar(1)); |
| 732 | const bool is_inf = numext::equal_strict(x1p, log_1p); |
| 733 | return (is_small || is_inf) ? x : x * (log_1p / (x1p - RealScalar(1))); |
| 734 | } |
| 735 | } |
| 736 | |
| 737 | template<typename Scalar> |
no test coverage detected