GCC Code Coverage Report


Directory: include/polyfloat/
File: include/polyfloat/module/core/minus.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
15 namespace plf
16 {
17
18 template<typename Options> struct minus_t : eve::elementwise_callable<minus_t, Options, raw_option, pedantic_option>
19 {
20 668204 template<concepts::polyfloat_like Z> POLYFLOAT_ABI constexpr Z operator()(Z z) const noexcept
21 {
22 668204 return POLYFLOAT_CALL(z);
23 }
24
25 334274 POLYFLOAT_CALLABLE_OBJECT(minus_t, minus_);
26 };
27 //======================================================================================================================
28 //! @addtogroup core
29 //! @{
30 //! @var minus
31 //! @brief return the opposite value.
32 //!
33 //! @groupheader{Header file}
34 //!
35 //! @code
36 //! #include <polyfloat/core.hpp>
37 //! @endcode
38 //!
39 //! @groupheader{Callable Signatures}
40 //!
41 //! @code
42 //! namespace polyfloat
43 //! {
44 //! template<polyfloat::concepts::polyfloat_like T> constexpr auto minus(T z) noexcept;
45 //! }
46 //! @endcode
47 //!
48 //! **Parameters**
49 //!
50 //! * `z`: Value to process.
51 //!
52 //! **Return value**
53 //!
54 //! Returns the opposite value of z.
55 //!
56 //! @groupheader{Example}
57 //!
58 //! @godbolt{doc/core/minus.cpp}
59 //======================================================================================================================
60
61 inline constexpr auto minus = eve::functor<minus_t>;
62 //======================================================================================================================
63 //! @}
64 //======================================================================================================================
65 }
66
67 namespace plf::_
68 {
69 334274 template<typename Z, eve::callable_options O> constexpr auto minus_(POLYFLOAT_DELAY(), O const&, Z const& z) noexcept
70 {
71 334274 return -z;
72 }
73
74 }
75