GCC Code Coverage Report


Directory: include/polyfloat/
File: include/polyfloat/module/math/constants/maxlog2.hpp
Date: 2026-11-09 15:28:50
Exec Total Coverage
Lines: 4 4 100.0%
Functions: 12 12 100.0%
Branches: 1 1 100.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
14 namespace plf
15 {
16
17 template<typename Options> struct maxlog2_t : eve::constant_callable<maxlog2_t, Options>
18 {
19 126 template<typename T> POLYFLOAT_ABI static constexpr T value(eve::as<T> const&, auto const&)
20 {
21 using u_t = eve::underlying_type_t<T>;
22
1/1
✓ Branch 2 taken 63 times.
126 return u_t(eve::maxlog2(eve::as<u_t>()));
23 // if constexpr (plf::dimension_v<T> == 1)
24 // {
25 // if constexpr (std::same_as<u_t, float>) return float(0x1.62e43p+6);
26 // else if constexpr (std::same_as<u_t, double>) return double(0x1.62e42fefa39efp+9);
27 // }
28 // else if constexpr (plf::dimension_v<T> == 2)
29 // {
30 // if constexpr (std::same_as<u_t, float>) return plf::_::from_pair<float>(0x1.62p+6, 0x0.0p1);
31 // else if constexpr (std::same_as<u_t, double>) return plf::_::from_pair<double>(0x1.62e42fefa39efp+9, 0x0.0p+1);
32 // }
33 // else if constexpr (plf::dimension_v<T> == 3)
34 // {
35 // if constexpr (std::same_as<u_t, float>) return plf::_::from_triple<float>(0x1.62p+6, 0x0.0p+1, 0x0.0p1);
36 // else if constexpr (std::same_as<u_t, double>)
37 // return plf::_::from_triple<double>(0x1.62e42fefa39efp+9, 0x0.0p+1, 0x0.0p1);
38 // }
39 }
40
41 126 template<concepts::polyfloat_like T> POLYFLOAT_ABI constexpr T operator()(as<T> const& v) const
42 {
43 126 return POLYFLOAT_CALL(v);
44 }
45
46 POLYFLOAT_CALLABLE_OBJECT(maxlog2_t, maxlog2_);
47 };
48 //======================================================================================================================
49 //! @addtogroup constants
50 //! @{
51 //! @var maxlog2
52 //! @brief return the exp(1) value.
53 //!
54 //! @groupheader{Header file}
55 //!
56 //! @code
57 //! #include <polyfloat/core.hpp>
58 //! @endcode
59 //!
60 //! @groupheader{Callable Signatures}
61 //!
62 //! @code
63 //! namespace polyfloat
64 //! {
65 //! template<polyfloat::concepts::polyfloat_like T> constexpr auto maxlog2(T z) noexcept;
66 //! }
67 //! @endcode
68 //!
69 //!
70 //! **Return value**
71 //!
72 //! Returns exp(1).
73 //!
74 //! @groupheader{Example}
75 //!
76 //! @godbolt_todo{doc/maxlog2.cpp}
77 //======================================================================================================================
78
79 inline constexpr auto maxlog2 = eve::functor<maxlog2_t>;
80 //======================================================================================================================
81 //! @}
82 //======================================================================================================================
83 }
84