GCC Code Coverage Report


Directory: include/polyfloat/
File: include/polyfloat/module/core/is_flint.hpp
Date: 2026-11-09 15:28:50
Exec Total Coverage
Lines: 6 6 100.0%
Functions: 37 37 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_flint_t : plf::elementwise_callable<is_flint_t, eve::is_flint_t, Options, raw_option, pedantic_option>
20 {
21 template<concepts::polyfloat_like Z>
22 191114 POLYFLOAT_ABI constexpr eve::as_logical_t<plf::as_component_type_t<Z>> operator()(Z z) const noexcept
23 {
24 191114 return POLYFLOAT_CALL(z);
25 }
26
27 191112 POLYFLOAT_CALLABLE_OBJECT(is_flint_t, is_flint_);
28 };
29
30 //================================================================================================
31 //! @addtogroup core
32 //! @{
33 //! @var is_flint
34 //! @brief returns a logical true if and only if the element value is a floating value
35 //! representing an integer
36 //!
37 //! @groupheader{Header file}
38 //!
39 //! @code
40 //! #include <eve/module/module/core.hpp>
41 //! @endcode
42 //!
43 //! @groupheader{Callable Signatures}
44 //!
45 //! @code
46 //! namespace eve
47 //! {
48 //! // Regular overloads
49 //! constexpr auto is_flint(floating_value auto x) noexcept; // 1
50 //! constexpr auto is_flint(integer_value auto x) noexcept; // 2
51 //!
52 //! // Lanes masking
53 //! constexpr auto is_flint[conditional_expr auto c](value auto x) noexcept; // 3
54 //! constexpr auto is_flint[logical_value auto m](value auto x) noexcept; // 3
55 //!
56 //! // Semantic options
57 //! constexpr auto is_flint[pedantic](floating_value auto x) noexcept; // 4
58 //! }
59 //! @endcode
60 //!
61 //! **Parameters**
62 //!
63 //! * `x`: [argument](@ref eve::value).
64 //! * `c`: [Conditional expression](@ref eve::conditional_expr) masking the operation.
65 //! * `m`: [Logical value](@ref eve::logical_value) masking the operation.
66 //!
67 //! **Return value**
68 //!
69 //! 1. The call `is_flint(x)` is semantically equivalent to `is_flint (eve::frac(x))`;
70 //! This means that x represents an integral value.
71 //! 2. Always returns `true`.
72 //! 3. [The operation is performed conditionnaly](@ref conditional).
73 //! 4. The call `is_flint[pedantic](x)` also check that the input is not greater or equal to the
74 //! largest consecutive integer in the element type of `x` (`maxflint(as(x))`).
75 //!
76 //! @groupheader{Example}
77 //! @godbolt{doc/core/is_flint.cpp}
78 //================================================================================================
79 inline constexpr auto is_flint = eve::functor<is_flint_t>;
80 //======================================================================================================================
81 //! @}
82 //======================================================================================================================
83 }
84
85 namespace plf::_
86 {
87 template<typename Z, eve::callable_options O>
88 191112 constexpr auto is_flint_(POLYFLOAT_DELAY(), O const&, Z const& z) noexcept
89 {
90 33498 if constexpr (dimension_v<Z> == 2) return eve::is_flint(lo(z)) && eve::is_flint(hi(z));
91 else if constexpr (dimension_v<Z> == 3)
92 157614 return eve::is_flint(lo(z)) && eve::is_flint(md(z)) && (eve::is_flint(hi(z)));
93 }
94 }
95