GCC Code Coverage Report


Directory: include/polyfloat/
File: include/polyfloat/module/core/constants/nan.hpp
Date: 2026-11-09 15:28:50
Exec Total Coverage
Lines: 4 4 100.0%
Functions: 19 19 100.0%
Branches: 1 1 100.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 <eve/eve.hpp>
11 #include <polyfloat/details/callable.hpp>
12 #include <polyfloat/types/concepts.hpp>
13 #include <polyfloat/types/traits.hpp>
14
15 namespace plf
16 {
17 template<typename Options> struct nan_t : eve::constant_callable<nan_t, Options>
18 {
19 3082 template<typename T> POLYFLOAT_ABI static constexpr auto value(eve::as<T> const&, auto const&)
20 {
21 using u_t = eve::underlying_type_t<T>;
22
1/1
✓ Branch 2 taken 1541 times.
3082 return T(eve::nan(eve::as<u_t>()));
23 }
24
25 3082 template<concepts::polyfloat_like T> POLYFLOAT_ABI constexpr T operator()(as<T> const& v) const
26 {
27 3082 return POLYFLOAT_CALL(v);
28 }
29
30 POLYFLOAT_CALLABLE_OBJECT(nan_t, nan_);
31 };
32 //======================================================================================================================
33 //! @addtogroup constants
34 //! @{
35 //! @var nan
36 //! @brief return the naninite value.
37 //!
38 //! @groupheader{Header file}
39 //!
40 //! @code
41 //! #include <polyfloat/core.hpp>
42 //! @endcode
43 //!
44 //! @groupheader{Callable Signatures}
45 //!
46 //! @code
47 //! namespace polyfloat
48 //! {
49 //! template<polyfloat::concepts::polyfloat_like T> constexpr auto nan(as<T>) noexcept;
50 //! }
51 //! @endcode
52 //!
53 //! **Parameters**
54 //!
55 //! * `T`: type to return.
56 //!
57 //! **Return value**
58 //!
59 //! Returns the nan value in type T.
60 //!
61 //! @groupheader{Example}
62 //!
63 //! @godbolt_todo{doc/nan.cpp}
64 //======================================================================================================================
65
66 inline constexpr auto nan = eve::functor<nan_t>;
67 //======================================================================================================================
68 //! @}
69 //======================================================================================================================
70 }
71