GCC Code Coverage Report


Directory: include/polyfloat/
File: include/polyfloat/module/core/is_ordered.hpp
Date: 2026-11-09 15:28:50
Exec Total Coverage
Lines: 5 5 100.0%
Functions: 30 30 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/abs.hpp>
15
16 namespace plf
17 {
18
19 template<typename Options> struct is_ordered_t : eve::callable<is_ordered_t, Options, raw_option, pedantic_option>
20 {
21 template<concepts::polyfloat_like Z1, concepts::polyfloat_like Z2>
22 52 POLYFLOAT_ABI constexpr eve::as_logical_t<as_polyfloat_like_t<Z1, Z2>> operator()(Z1 z1, Z2 z2) const noexcept
23 {
24 52 return POLYFLOAT_CALL(z1, z2);
25 }
26
27 52 POLYFLOAT_CALLABLE_OBJECT(is_ordered_t, is_ordered_);
28 };
29 //======================================================================================================================
30 //! @addtogroup core
31 //! @{
32 //! @var is_ordered
33 //! @brief return a logical true if and only if no parameter is NaN.
34 //!
35 //! @groupheader{Header file}
36 //!
37 //! @code
38 //! #include <polyfloat/core.hpp>
39 //! @endcode
40 //!
41 //! @groupheader{Callable Signatures}
42 //!
43 //! @code
44 //! namespace polyfloat
45 //! {
46 //! template<polyfloat::concepts::polyfloat_like T1, polyfloat_like Z2> constexpr auto is_ordered(T1 z1, T2 z2) noexcept;
47 //! }
48 //! @endcode
49 //!
50 //! **Parameters**
51 //!
52 //! * `z`: Value to process.
53 //!
54 //! **Return value**
55 //!
56 //! Returns `is_not_nan(z1) && is_not_nan(z2)`.
57 //!
58 //! @groupheader{Example}
59 //!
60 //! @godbolt{doc/core/is_ordered.cpp}
61 //======================================================================================================================
62
63 inline constexpr auto is_ordered = eve::functor<is_ordered_t>;
64 //======================================================================================================================
65 //! @}
66 //======================================================================================================================
67 }
68
69 namespace plf::_
70 {
71 template<typename Z1, typename Z2, eve::callable_options O>
72 52 constexpr auto is_ordered_(POLYFLOAT_DELAY(), O const&, Z1 const& z1, Z2 const& z2) noexcept
73 {
74 52 return eve::is_ordered(hi(z1), hi(z2));
75 }
76 }
77