BEEP-8 Helper Lib 1.0.0
Loading...
Searching...
No Matches
fpm::fixed< BaseType, IntermediateType, FractionBits > Class Template Reference

#include <fixed.h>

Public Member Functions

constexpr operator int () const noexcept
 
fixedneg ()
 
fixedasr (int bits_)
 
fixedlsl (int bits_)
 
template<typename T , typename std::enable_if< std::is_integral< T >::value >::type * = nullptr>
constexpr fixed (T val) noexcept
 
template<typename T , typename std::enable_if< std::is_floating_point< T >::value >::type * = nullptr>
constexpr fixed (T val) noexcept
 
template<typename B , typename I , unsigned int F>
constexpr fixed (fixed< B, I, F > val) noexcept
 
constexpr fixed (int numerator_, int denominator_) noexcept
 
template<typename T , typename std::enable_if< std::is_floating_point< T >::value >::type * = nullptr>
constexpr operator T () const noexcept
 
template<typename T , typename std::enable_if< std::is_integral< T >::value >::type * = nullptr>
constexpr operator T () const noexcept
 
constexpr BaseType raw_value () const noexcept
 
constexpr BaseType set_raw_value (BaseType x_) noexcept
 
constexpr fixed operator- () const noexcept
 
constexpr fixed operator+ () const noexcept
 
fixedoperator+= (const fixed &y) noexcept
 
template<typename I , typename std::enable_if< std::is_integral< I >::value >::type * = nullptr>
fixedoperator+= (I y) noexcept
 
fixedoperator-= (const fixed &y) noexcept
 
template<typename I , typename std::enable_if< std::is_integral< I >::value >::type * = nullptr>
fixedoperator-= (I y) noexcept
 
fixedoperator*= (const fixed &y) noexcept
 
template<typename I , typename std::enable_if< std::is_integral< I >::value >::type * = nullptr>
fixedoperator*= (I y) noexcept
 
fixedoperator/= (const fixed &y) noexcept
 
template<typename I , typename std::enable_if< std::is_integral< I >::value >::type * = nullptr>
fixedoperator/= (I y) noexcept
 

Static Public Member Functions

template<unsigned int NumFractionBits, typename T , typename std::enable_if<(NumFractionBits > FractionBits)>::type * = nullptr>
static constexpr fixed from_fixed_point (T value) noexcept
 
template<unsigned int NumFractionBits, typename T , typename std::enable_if<(NumFractionBits<=FractionBits)>::type * = nullptr>
static constexpr fixed from_fixed_point (T value) noexcept
 
static constexpr fixed from_raw_value (BaseType value) noexcept
 
static constexpr fixed e ()
 
static constexpr fixed pi ()
 
static constexpr fixed half_pi ()
 
static constexpr fixed two_pi ()
 

Detailed Description

template<typename BaseType, typename IntermediateType, unsigned int FractionBits>
class fpm::fixed< BaseType, IntermediateType, FractionBits >

Fixed-point number type

Template Parameters
BaseTypethe base integer type used to store the fixed-point number. This can be a signed or unsigned type.
IntermediateTypethe integer type used to store intermediate results during calculations.
FractionBitsthe number of bits of the BaseType used to store the fraction

Member Function Documentation

◆ from_fixed_point()

template<typename BaseType , typename IntermediateType , unsigned int FractionBits>
template<unsigned int NumFractionBits, typename T , typename std::enable_if<(NumFractionBits > FractionBits)>::type * = nullptr>
static constexpr fixed fpm::fixed< BaseType, IntermediateType, FractionBits >::from_fixed_point ( T value)
inlinestaticconstexprnoexcept

Constructs a fixed-point number from another fixed-point number.

Template Parameters
NumFractionBitsthe number of bits used by the fraction in value.
Parameters
valuethe integer fixed-point number

The documentation for this class was generated from the following file: