RandomLib  1.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
Public Types | Static Public Member Functions | List of all members
RandomLib::RandomPower2 Class Reference

Return or multiply by powers of 2. More...

#include <RandomLib/RandomPower2.hpp>

Public Types

enum  { minpow = -64, maxpow = 64 }
 

Static Public Member Functions

template<typename RealType >
static RealType pow2 (int n) throw ()
 
template<typename RealType >
static RealType shiftf (RealType x, int n) throw ()
 

Detailed Description

Return or multiply by powers of 2.

With some compilers it's fastest to do a table lookup of powers of

  1. If RANDOMLIB_POWERTABLE is 1, a lookup table is used. If RANDOMLIB_POWERTABLE is 0, then std::pow is used.

Definition at line 26 of file RandomPower2.hpp.

Member Enumeration Documentation

anonymous enum
Enumerator
minpow 

Minimum power in RandomPower2::power2

maxpow 

Maximum power in RandomPower2::power2.

Definition at line 55 of file RandomPower2.hpp.

Member Function Documentation

template<typename RealType >
static RealType RandomLib::RandomPower2::pow2 ( int  n)
throw (
)
inlinestatic

Return powers of 2 (either using a lookup table or std::pow)

Parameters
[in]nthe integer power.
Returns
2n.

Definition at line 34 of file RandomPower2.hpp.

template<typename RealType >
static RealType RandomLib::RandomPower2::shiftf ( RealType  x,
int  n 
)
throw (
)
inlinestatic

Multiply a real by a power of 2

Template Parameters
RealTypethe type of x.
Parameters
[in]xthe real number.
[in]nthe power (positive or negative).
Returns
x 2n.

Definition at line 50 of file RandomPower2.hpp.


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