4#ifndef TETL_CMATH_NEXTAFTER_HPP
5#define TETL_CMATH_NEXTAFTER_HPP
7#include <etl/_bit/bit_cast.hpp>
8#include <etl/_cstdint/uint_t.hpp>
9#include <etl/_type_traits/conditional.hpp>
10#include <etl/_type_traits/is_same.hpp>
17[[nodiscard]]
constexpr auto nextafter(T from, T to) -> T
19 using U =
etl::conditional_t<
sizeof(T) == 4U,
etl::uint32_t,
etl::uint64_t>;
20 auto const fromBits =
etl::bit_cast<U>(from);
21 auto const toBits =
etl::bit_cast<U>(to);
22 if (toBits == fromBits) {
25 if (toBits > fromBits) {
26 return etl::bit_cast<T>(fromBits + 1);
28 return etl::bit_cast<T>(fromBits - 1);
40 return detail::nextafter(from, to);
44 return detail::nextafter(from, to);
48 return detail::nextafter(from, to);
constexpr auto nextafter(double from, double to) noexcept -> double
Definition nextafter.hpp:46
constexpr auto nextafterf(float from, float to) noexcept -> float
Definition nextafter.hpp:42
constexpr auto nextafter(float from, float to) noexcept -> float
Definition nextafter.hpp:38
Definition adjacent_find.hpp:9