GCC Code Coverage Report


Directory: include/polyfloat/
File: include/polyfloat/module/math/constants/pio_4.hpp
Date: 2026-11-09 15:28:50
Exec Total Coverage
Lines: 7 7 100.0%
Functions: 14 14 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 pio_4_t : plf::constant_callable<pio_4_t, eve::pio_4_t, Options, lower_option, upper_option>
18 {
19 81952 template<typename T> POLYFLOAT_ABI static constexpr auto value(eve::as<T> const&, auto const&)
20 {
21 using u_t = eve::underlying_type_t<T>;
22
23 if constexpr (plf::dimension_v<T> == 2)
24 {
25 if constexpr (std::same_as<u_t, float>)
26 2934 return plf::_::from_pair<u_t>(0x1.921fb60000000p-1, -0x1.777a5c0000000p-26);
27 else if constexpr (std::same_as<u_t, double>)
28 2878 return plf::_::from_pair<u_t>(0x1.921fb54442d18p-1, 0x1.1a62633145c07p-55);
29 }
30 else if constexpr (plf::dimension_v<T> == 3)
31 {
32 if constexpr (std::same_as<u_t, float>)
33 38068 return plf::_::from_triple<u_t>(0x1.921fb60000000p-1, -0x1.777a5c0000000p-26, -0x1.ee59da0000000p-51);
34 else if constexpr (std::same_as<u_t, double>)
35 38072 return plf::_::from_triple<u_t>(0x1.921fb54442d18p-1, 0x1.1a62633145c07p-55, -0x1.f1976b7ed8fbcp-111);
36 }
37 }
38
39 81960 template<concepts::polyfloat_like T> POLYFLOAT_ABI constexpr T operator()(as<T> const& v) const
40 {
41 81960 return POLYFLOAT_CALL(v);
42 }
43
44 POLYFLOAT_CALLABLE_OBJECT(pio_4_t, pio_4_);
45 };
46 //======================================================================================================================
47 //! @addtogroup constants
48 //! @{
49 //! @var pio_4
50 //! @brief return the pio_4 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 pio_4(T z) noexcept;
64 //! }
65 //! @endcode
66 //!
67 //! **Parameters**
68 //!
69 //! * `z`: Value to process.
70 //!
71 //! **Return value**
72 //!
73 //! Returns the pio_4 value as T.
74 //!
75 //! @groupheader{Example}
76 //!
77 //! @godbolt_todo{doc/pio_4.cpp}
78 //======================================================================================================================
79
80 inline constexpr auto pio_4 = eve::functor<pio_4_t>;
81 //======================================================================================================================
82 //! @}
83 //======================================================================================================================
84 }
85