bpp-phyl3  3.0.0
bpp::ExtendedFloat Class Reference

#include <Bpp/Phyl/Likelihood/DataFlow/ExtendedFloat.h>

+ Inheritance diagram for bpp::ExtendedFloat:

Public Types

using FloatType = double
 
using ExtType = int
 

Public Member Functions

constexpr ExtendedFloat (FloatType f=0.0, ExtType e=0) noexcept
 
 ExtendedFloat (const ExtendedFloat &ef) noexcept
 
const FloatTypefloat_part () const noexcept
 
const ExtTypeexponent_part () const noexcept
 
bool normalize_big () noexcept
 
bool normalize_small ()
 
void normalize () noexcept
 
ExtendedFloatoperator= (const ExtendedFloat &ef)
 
ExtendedFloat operator+ (const ExtendedFloat &rhs) const
 
ExtendedFloat operator- (const ExtendedFloat &rhs) const
 
template<typename F , typename = typename std::enable_if<std::is_arithmetic<F>::value>::type>
ExtendedFloat operator- (const F &rhs) const
 
ExtendedFloat operator* (const ExtendedFloat &rhs) const
 
template<typename F , typename = typename std::enable_if<std::is_arithmetic<F>::value>::type>
ExtendedFloat operator* (const F &rhs) const
 
ExtendedFloat operator/ (const ExtendedFloat &rhs) const
 
ExtendedFloatoperator*= (const ExtendedFloat &rhs)
 
ExtendedFloatoperator/= (const ExtendedFloat &rhs)
 
ExtendedFloatoperator+= (const ExtendedFloat &rhs)
 
ExtendedFloatoperator-= (const ExtendedFloat &rhs)
 
ExtendedFloat operator- () const
 
ExtendedFloat pow (double exp) const
 
ExtendedFloat pow (int exp) const
 
bool operator== (const ExtendedFloat &rhs) const
 
bool operator!= (const ExtendedFloat &rhs) const
 
bool operator< (const ExtendedFloat &rhs) const
 
bool operator<= (const ExtendedFloat &rhs) const
 
bool operator>= (const ExtendedFloat &rhs) const
 
bool operator>= (const double &rhs) const
 
bool operator> (const ExtendedFloat &rhs) const
 
bool operator> (const double &rhs) const
 
double log () const
 
ExtendedFloat abs () const
 
std::tuple< int, double > lround () const
 
ExtendedFloat exp () const
 

Static Public Member Functions

static ExtendedFloat denorm_mul (const ExtendedFloat &lhs, const ExtendedFloat &rhs)
 
static ExtendedFloat denorm_div (const ExtendedFloat &lhs, const ExtendedFloat &rhs)
 
static ExtendedFloat denorm_add (const ExtendedFloat &lhs, const ExtendedFloat &rhs)
 
static ExtendedFloat denorm_sub (const ExtendedFloat &lhs, const ExtendedFloat &rhs)
 
static ExtendedFloat denorm_sub (const ExtendedFloat &lhs, const double &rhs)
 
static ExtendedFloat denorm_pow (const ExtendedFloat &lhs, double exp)
 
static ExtendedFloat denorm_pow (const ExtendedFloat &lhs, int exp)
 
static double convert (const ExtendedFloat &ef)
 

Static Public Attributes

static constexpr int allowed_product_without_normalization = 2
 
static constexpr int radix = std::numeric_limits<FloatType>::radix
 
static const double ln_radix
 
static constexpr int biggest_repr_radix_power = std::numeric_limits<FloatType>::max_exponent - 1
 
static constexpr int biggest_normalized_radix_power
 
static constexpr FloatType biggest_normalized_value
 
static constexpr int smallest_repr_radix_power = std::numeric_limits<FloatType>::min_exponent + 1
 
static constexpr int smallest_normalized_radix_power
 
static constexpr FloatType smallest_normalized_value
 
static constexpr FloatType normalize_big_factor = 1. / biggest_normalized_value
 
static constexpr FloatType normalize_small_factor = 1. / smallest_normalized_value
 

Protected Member Functions

FloatTypefloat_part () noexcept
 
ExtTypeexponent_part () noexcept
 

Protected Attributes

FloatType f_
 
ExtType exp_
 

Private Member Functions

 operator double () const
 

Friends

template<typename Scalar , typename NullaryOp , bool has_nullary, bool has_unary, bool has_binary>
struct Eigen::internal::nullary_wrapper
 

Detailed Description

Definition at line 37 of file ExtendedFloat.h.

Member Typedef Documentation

◆ ExtType

Definition at line 43 of file ExtendedFloat.h.

◆ FloatType

Definition at line 42 of file ExtendedFloat.h.

Constructor & Destructor Documentation

◆ ExtendedFloat() [1/2]

constexpr bpp::ExtendedFloat::ExtendedFloat ( FloatType  f = 0.0,
ExtType  e = 0 
)
inlineconstexprnoexcept

Definition at line 82 of file ExtendedFloat.h.

Referenced by abs(), denorm_add(), denorm_pow(), denorm_sub(), exp(), and operator-().

◆ ExtendedFloat() [2/2]

bpp::ExtendedFloat::ExtendedFloat ( const ExtendedFloat ef)
inlinenoexcept

Definition at line 85 of file ExtendedFloat.h.

Member Function Documentation

◆ abs()

ExtendedFloat bpp::ExtendedFloat::abs ( ) const
inline

Definition at line 357 of file ExtendedFloat.h.

References bpp::abs(), exponent_part(), ExtendedFloat(), and float_part().

Referenced by bpp::abs().

◆ convert()

static double bpp::ExtendedFloat::convert ( const ExtendedFloat ef)
inlinestatic

Definition at line 418 of file ExtendedFloat.h.

References exponent_part(), float_part(), and radix.

Referenced by lround(), operator>(), and operator>=().

◆ denorm_add()

static ExtendedFloat bpp::ExtendedFloat::denorm_add ( const ExtendedFloat lhs,
const ExtendedFloat rhs 
)
inlinestatic

Definition at line 142 of file ExtendedFloat.h.

References exponent_part(), ExtendedFloat(), float_part(), and radix.

Referenced by operator+().

◆ denorm_div()

static ExtendedFloat bpp::ExtendedFloat::denorm_div ( const ExtendedFloat lhs,
const ExtendedFloat rhs 
)
inlinestatic

Definition at line 137 of file ExtendedFloat.h.

References exponent_part(), and float_part().

Referenced by denorm_pow(), and operator/().

◆ denorm_mul()

static ExtendedFloat bpp::ExtendedFloat::denorm_mul ( const ExtendedFloat lhs,
const ExtendedFloat rhs 
)
inlinestatic

Definition at line 132 of file ExtendedFloat.h.

References exponent_part(), and float_part().

Referenced by bpp::SumOfLogarithms< F >::compute(), denorm_pow(), and operator*().

◆ denorm_pow() [1/2]

static ExtendedFloat bpp::ExtendedFloat::denorm_pow ( const ExtendedFloat lhs,
double  exp 
)
inlinestatic

Definition at line 163 of file ExtendedFloat.h.

References exp(), exponent_part(), float_part(), bpp::pow(), and radix.

Referenced by denorm_pow(), and pow().

◆ denorm_pow() [2/2]

static ExtendedFloat bpp::ExtendedFloat::denorm_pow ( const ExtendedFloat lhs,
int  exp 
)
inlinestatic

◆ denorm_sub() [1/2]

static ExtendedFloat bpp::ExtendedFloat::denorm_sub ( const ExtendedFloat lhs,
const double &  rhs 
)
inlinestatic

Definition at line 156 of file ExtendedFloat.h.

References exponent_part(), ExtendedFloat(), float_part(), and radix.

◆ denorm_sub() [2/2]

static ExtendedFloat bpp::ExtendedFloat::denorm_sub ( const ExtendedFloat lhs,
const ExtendedFloat rhs 
)
inlinestatic

Definition at line 149 of file ExtendedFloat.h.

References exponent_part(), ExtendedFloat(), float_part(), and radix.

Referenced by operator-().

◆ exp()

ExtendedFloat bpp::ExtendedFloat::exp ( ) const
inline

Definition at line 395 of file ExtendedFloat.h.

References exponent_part(), ExtendedFloat(), float_part(), ln_radix, bpp::pow(), and radix.

Referenced by denorm_pow(), bpp::exp(), and pow().

◆ exponent_part() [1/2]

◆ exponent_part() [2/2]

ExtType& bpp::ExtendedFloat::exponent_part ( )
inlineprotectednoexcept

Definition at line 428 of file ExtendedFloat.h.

References exp_.

◆ float_part() [1/2]

◆ float_part() [2/2]

FloatType& bpp::ExtendedFloat::float_part ( )
inlineprotectednoexcept

Definition at line 427 of file ExtendedFloat.h.

References f_.

◆ log()

double bpp::ExtendedFloat::log ( ) const
inline

Definition at line 352 of file ExtendedFloat.h.

References exponent_part(), float_part(), ln_radix, and bpp::log().

Referenced by bpp::SumOfLogarithms< F >::compute(), and bpp::log().

◆ lround()

std::tuple<int, double> bpp::ExtendedFloat::lround ( ) const
inline

◆ normalize()

void bpp::ExtendedFloat::normalize ( )
inlinenoexcept

◆ normalize_big()

bool bpp::ExtendedFloat::normalize_big ( )
inlinenoexcept

◆ normalize_small()

bool bpp::ExtendedFloat::normalize_small ( )
inline

◆ operator double()

bpp::ExtendedFloat::operator double ( ) const
inlineprivate

Definition at line 408 of file ExtendedFloat.h.

References float_part().

◆ operator!=()

bool bpp::ExtendedFloat::operator!= ( const ExtendedFloat rhs) const
inline

Definition at line 317 of file ExtendedFloat.h.

References exponent_part(), and float_part().

◆ operator*() [1/2]

ExtendedFloat bpp::ExtendedFloat::operator* ( const ExtendedFloat rhs) const
inline

Definition at line 221 of file ExtendedFloat.h.

References denorm_mul().

◆ operator*() [2/2]

template<typename F , typename = typename std::enable_if<std::is_arithmetic<F>::value>::type>
ExtendedFloat bpp::ExtendedFloat::operator* ( const F &  rhs) const
inline

Definition at line 229 of file ExtendedFloat.h.

References exponent_part(), float_part(), and normalize().

◆ operator*=()

ExtendedFloat& bpp::ExtendedFloat::operator*= ( const ExtendedFloat rhs)
inline

Definition at line 243 of file ExtendedFloat.h.

References exponent_part(), float_part(), and normalize().

◆ operator+()

ExtendedFloat bpp::ExtendedFloat::operator+ ( const ExtendedFloat rhs) const
inline

Definition at line 199 of file ExtendedFloat.h.

References denorm_add().

◆ operator+=()

ExtendedFloat& bpp::ExtendedFloat::operator+= ( const ExtendedFloat rhs)
inline

Definition at line 259 of file ExtendedFloat.h.

References exponent_part(), float_part(), normalize(), and radix.

◆ operator-() [1/3]

ExtendedFloat bpp::ExtendedFloat::operator- ( ) const
inline

Definition at line 289 of file ExtendedFloat.h.

References exponent_part(), ExtendedFloat(), and float_part().

◆ operator-() [2/3]

ExtendedFloat bpp::ExtendedFloat::operator- ( const ExtendedFloat rhs) const
inline

Definition at line 206 of file ExtendedFloat.h.

References denorm_sub().

◆ operator-() [3/3]

template<typename F , typename = typename std::enable_if<std::is_arithmetic<F>::value>::type>
ExtendedFloat bpp::ExtendedFloat::operator- ( const F &  rhs) const
inline

Definition at line 214 of file ExtendedFloat.h.

References denorm_sub().

◆ operator-=()

ExtendedFloat& bpp::ExtendedFloat::operator-= ( const ExtendedFloat rhs)
inline

Definition at line 274 of file ExtendedFloat.h.

References exponent_part(), float_part(), normalize(), and radix.

◆ operator/()

ExtendedFloat bpp::ExtendedFloat::operator/ ( const ExtendedFloat rhs) const
inline

Definition at line 236 of file ExtendedFloat.h.

References denorm_div().

◆ operator/=()

ExtendedFloat& bpp::ExtendedFloat::operator/= ( const ExtendedFloat rhs)
inline

Definition at line 251 of file ExtendedFloat.h.

References exponent_part(), float_part(), and normalize().

◆ operator<()

bool bpp::ExtendedFloat::operator< ( const ExtendedFloat rhs) const
inline

Definition at line 322 of file ExtendedFloat.h.

References exponent_part(), and float_part().

◆ operator<=()

bool bpp::ExtendedFloat::operator<= ( const ExtendedFloat rhs) const
inline

Definition at line 327 of file ExtendedFloat.h.

References exponent_part(), and float_part().

◆ operator=()

ExtendedFloat& bpp::ExtendedFloat::operator= ( const ExtendedFloat ef)
inline

Definition at line 192 of file ExtendedFloat.h.

References exp_, exponent_part(), f_, and float_part().

◆ operator==()

bool bpp::ExtendedFloat::operator== ( const ExtendedFloat rhs) const
inline

Definition at line 312 of file ExtendedFloat.h.

References exponent_part(), and float_part().

◆ operator>() [1/2]

bool bpp::ExtendedFloat::operator> ( const double &  rhs) const
inline

Definition at line 347 of file ExtendedFloat.h.

References convert().

◆ operator>() [2/2]

bool bpp::ExtendedFloat::operator> ( const ExtendedFloat rhs) const
inline

Definition at line 342 of file ExtendedFloat.h.

References exponent_part(), and float_part().

◆ operator>=() [1/2]

bool bpp::ExtendedFloat::operator>= ( const double &  rhs) const
inline

Definition at line 337 of file ExtendedFloat.h.

References convert().

◆ operator>=() [2/2]

bool bpp::ExtendedFloat::operator>= ( const ExtendedFloat rhs) const
inline

Definition at line 332 of file ExtendedFloat.h.

References exponent_part(), and float_part().

◆ pow() [1/2]

ExtendedFloat bpp::ExtendedFloat::pow ( double  exp) const
inline

Definition at line 294 of file ExtendedFloat.h.

References denorm_pow(), and exp().

Referenced by bpp::pow().

◆ pow() [2/2]

ExtendedFloat bpp::ExtendedFloat::pow ( int  exp) const
inline

Definition at line 301 of file ExtendedFloat.h.

References denorm_pow(), and exp().

Friends And Related Function Documentation

◆ Eigen::internal::nullary_wrapper

template<typename Scalar , typename NullaryOp , bool has_nullary, bool has_unary, bool has_binary>
friend struct Eigen::internal::nullary_wrapper
friend

Definition at line 414 of file ExtendedFloat.h.

Member Data Documentation

◆ allowed_product_without_normalization

constexpr int bpp::ExtendedFloat::allowed_product_without_normalization = 2
staticconstexpr

Definition at line 46 of file ExtendedFloat.h.

◆ biggest_normalized_radix_power

constexpr int bpp::ExtendedFloat::biggest_normalized_radix_power
staticconstexpr
Initial value:
=
static constexpr int allowed_product_without_normalization
Definition: ExtendedFloat.h:46
static constexpr int biggest_repr_radix_power
Definition: ExtendedFloat.h:54

Definition at line 57 of file ExtendedFloat.h.

Referenced by lround(), normalize_big(), and bpp::ExtendedFloatEigen< R, C, EigenType >::normalize_big().

◆ biggest_normalized_value

constexpr FloatType bpp::ExtendedFloat::biggest_normalized_value
staticconstexpr

◆ biggest_repr_radix_power

constexpr int bpp::ExtendedFloat::biggest_repr_radix_power = std::numeric_limits<FloatType>::max_exponent - 1
staticconstexpr

Definition at line 54 of file ExtendedFloat.h.

◆ exp_

◆ f_

◆ ln_radix

const double bpp::ExtendedFloat::ln_radix
static

◆ normalize_big_factor

constexpr FloatType bpp::ExtendedFloat::normalize_big_factor = 1. / biggest_normalized_value
staticconstexpr

◆ normalize_small_factor

constexpr FloatType bpp::ExtendedFloat::normalize_small_factor = 1. / smallest_normalized_value
staticconstexpr

◆ radix

◆ smallest_normalized_radix_power

constexpr int bpp::ExtendedFloat::smallest_normalized_radix_power
staticconstexpr

◆ smallest_normalized_value

constexpr FloatType bpp::ExtendedFloat::smallest_normalized_value
staticconstexpr

◆ smallest_repr_radix_power

constexpr int bpp::ExtendedFloat::smallest_repr_radix_power = std::numeric_limits<FloatType>::min_exponent + 1
staticconstexpr

Definition at line 66 of file ExtendedFloat.h.


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