GCC Code Coverage Report


Directory: include/polyfloat/
File: include/polyfloat/module/core/dec.hpp
Date: 2026-11-09 15:28:50
Exec Total Coverage
Lines: 5 5 100.0%
Functions: 54 54 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 <type_traits>
14 #include <polyfloat/module/core/minus.hpp>
15 #include <polyfloat/module/core/is_negative.hpp>
16 #include <polyfloat/module/core/add.hpp>
17
18 namespace plf
19 {
20
21 template<typename Options>
22 struct dec_t : plf::elementwise_callable<dec_t, eve::dec_t, Options, raw_option, pedantic_option>
23 {
24 177989 template<concepts::polyfloat_like Z> POLYFLOAT_ABI constexpr Z operator()(Z z) const noexcept
25 {
26 177989 return POLYFLOAT_CALL(z);
27 }
28
29 134441 POLYFLOAT_CALLABLE_OBJECT(dec_t, dec_);
30 };
31 //======================================================================================================================
32 //! @addtogroup core
33 //! @{
34 //! @var dec
35 //! @brief return the value minus one.
36 //!
37 //! @groupheader{Header file}
38 //!
39 //! @code
40 //! #include <polyfloat/core.hpp>
41 //! @endcode
42 //!
43 //! @groupheader{Callable Signatures}
44 //!
45 //! @code
46 //! namespace polyfloat
47 //! {
48 //! template<polyfloat::concepts::polyfloat_like T> constexpr auto dec(T z) noexcept;
49 //! }
50 //! @endcode
51 //!
52 //! **Parameters**
53 //!
54 //! * `z`: Value to process.
55 //!
56 //! **Return value**
57 //!
58 //! Returns the value of z-1.
59 //!
60 //! @groupheader{Example}
61 //!
62 //! @godbolt{doc/core/dec.cpp}
63 //======================================================================================================================
64
65 inline constexpr auto dec = eve::functor<dec_t>;
66 //======================================================================================================================
67 //! @}
68 //======================================================================================================================
69 }
70
71 namespace plf::_
72 {
73 134441 template<typename Z, eve::callable_options O> constexpr auto dec_(POLYFLOAT_DELAY(), O const& o, Z const& z) noexcept
74 {
75 134441 return plf::add[o](z, eve::mone(eve::as(hi(z))));
76 }
77 }
78