GCC Code Coverage Report


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