GCC Code Coverage Report


Directory: include/polyfloat/
File: include/polyfloat/module/core/is_negative.hpp
Date: 2026-11-09 15:28:50
Exec Total Coverage
Lines: 2 2 100.0%
Functions: 13 13 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>
19 struct is_negative_t : eve::elementwise_callable<is_negative_t, Options, raw_option, pedantic_option>
20 {
21 template<concepts::polyfloat_like Z>
22 388840 POLYFLOAT_ABI constexpr eve::as_logical_t<plf::as_component_type_t<Z>> operator()(Z z) const noexcept
23 {
24 388840 return eve::is_negative(hi(z));
25 }
26
27 POLYFLOAT_CALLABLE_OBJECT(is_negative_t, is_negative_);
28 };
29 //======================================================================================================================
30 //! @addtogroup core
31 //! @{
32 //! @var is_negative
33 //! @brief returns a logical true if and only if the element
34 //! has its sign bit set
35 //!
36 //! @groupheader{Header file}
37 //!
38 //! @code
39 //! #include <polyfloat/core.hpp>
40 //! @endcode
41 //!
42 //! @groupheader{Callable Signatures}
43 //!
44 //! @code
45 //! namespace polyfloat
46 //! {
47 //! template<polyfloat::concepts::polyfloat_like T> constexpr auto is_negative(T z) noexcept;
48 //! }
49 //! @endcode
50 //!
51 //! **Parameters**
52 //!
53 //! * `z`: Value to process.
54 //!
55 //! **Return value**
56 //!
57 //! returns true if and only if the bit of sign (most significant bit) is set.
58 //! Of course the result on a NaN input is generally out of control.
59 //!
60 //! @groupheader{Example}
61 //!
62 //! @godbolt{doc/core/is_negative.cpp}
63 //======================================================================================================================
64
65 inline constexpr auto is_negative = eve::functor<is_negative_t>;
66 }
67