libfxd 0.2.dev
A fixed-point library for C++.
|
#include <cmath>
#include <concepts>
#include <new>
#include <type_traits>
#include "concepts.hpp"
#include "casting.hpp"
#include "detail/bias.hpp"
#include "detail/int_to_float.hpp"
#include "detail/shift.hpp"
Go to the source code of this file.
Namespaces | |
namespace | fxd |
This is the namespace where the entire library is defined. | |
Functions | |
template<std::integral I, fixed_point Fxd> | |
constexpr I | to_int (Fxd f) noexcept |
Convert to integer. | |
template<fixed_point Fxd> requires detail::has_int_for<Fxd::int_bits, typename Fxd::raw_type> | |
constexpr detail::select_int_for< Fxd::int_bits, typename Fxd::raw_type > | to_int (Fxd f) noexcept |
Convert to the "natural integer" for this fixed-point type. | |
template<std::floating_point Flt, fixed_point Fxd> | |
constexpr Flt | to_float (Fxd f) noexcept |
Convert a fixed-point to a floating-point type, rounds to zero. | |
template<fixed_point Fxd> | |
constexpr std::numeric_limits< Fxd >::float_type | to_float (Fxd f) noexcept |
Converts a fixed-point to its natural floating-point type (with no losses/rounding). | |