GCC Code Coverage Report


Directory: include/polyfloat/
File: include/polyfloat/module/math/constants/log_10.hpp
Date: 2026-11-09 15:28:50
Exec Total Coverage
Lines: 7 7 100.0%
Functions: 12 12 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 //======================================================================================================================
2 /*
3 POLYFLOAT - Extended precision floating points
4 Copyright : POLYFLOAT Contributors & Maintainers
5 SPDX-License-Identifier: BSL-1.0
6 */
7 //======================================================================================================================
8 #pragma once
9
10 #include <polyfloat/details/callable.hpp>
11 #include <polyfloat/types/concepts.hpp>
12 #include <polyfloat/types/traits.hpp>
13 #include <eve/module/math/constant/log_10.hpp>
14
15 namespace plf
16 {
17
18 template<typename Options>
19 struct log_10_t : plf::constant_callable<log_10_t, eve::log_10_t, Options, lower_option, upper_option>
20 {
21 86 template<typename T> POLYFLOAT_ABI static constexpr T value(eve::as<T> const&, auto const&)
22 {
23 using u_t = plf::as_component_type_t<T>;
24 if constexpr (plf::dimension_v<T> == 2)
25 {
26 24 if constexpr (std::same_as<u_t, float>) return plf::_::from_pair<float>(0x1.26bb1cp+1, -0x1.12aabap-25);
27 else if constexpr (std::same_as<u_t, double>)
28 22 return plf::_::from_pair<double>(0x1.26bb1bbb55516p+1, -0x1.f48ad494ea3e9p-53);
29 }
30 else if constexpr (plf::dimension_v<T> == 3)
31 {
32 if constexpr (std::same_as<u_t, float>)
33 20 return plf::_::from_triple<float>(0x1.26bb1cp+1, -0x1.12aabap-25, -0x1.3e915ap-50);
34 else if constexpr (std::same_as<u_t, double>)
35 20 return plf::_::from_triple<double>(0x1.26bb1bbb55516p+1, -0x1.f48ad494ea3e9p-53, -0x1.9ebae3ae0260cp-107);
36 }
37 }
38
39 86 template<concepts::polyfloat_like T> POLYFLOAT_ABI constexpr T operator()(as<T> const& v) const
40 {
41 86 return POLYFLOAT_CALL(v);
42 }
43
44 POLYFLOAT_CALLABLE_OBJECT(log_10_t, log_10_);
45 };
46 //======================================================================================================================
47 //! @addtogroup constants
48 //! @{
49 //! @var log_10
50 //! @brief return the log(10) value.
51 //!
52 //! @groupheader{Header file}
53 //!
54 //! @code
55 //! #include <polyfloat/core.hpp>
56 //! @endcode
57 //!
58 //! @groupheader{Callable Signatures}
59 //!
60 //! @code
61 //! namespace polyfloat
62 //! {
63 //! template<polyfloat::concepts::polyfloat_like T> constexpr auto log_10(T z) noexcept;
64 //! }
65 //! @endcode
66 //!
67 //!
68 //! **Return value**
69 //!
70 //! Returns log(2).
71 //!
72 //! @groupheader{Example}
73 //!
74 //! @godbolt_todo{doc/log_10.cpp}
75 //======================================================================================================================
76
77 inline constexpr auto log_10 = eve::functor<log_10_t>;
78 //======================================================================================================================
79 //! @}
80 //======================================================================================================================
81 }
82