12 #if !defined(RANDOMLIB_RANDOMPOWER2_HPP)
13 #define RANDOMLIB_RANDOMPOWER2_HPP 1
34 template<
typename RealType>
static inline RealType
pow2(
int n)
throw() {
35 #if RANDOMLIB_POWERTABLE
36 return RealType(power2[n - minpow]);
38 return std::pow(RealType(2), n);
49 template<
typename RealType>
50 static inline RealType
shiftf(RealType x,
int n)
throw()
52 {
return x * pow2<RealType>(n); }
59 #if RANDOMLIB_LONGDOUBLEPREC > 64
67 #if RANDOMLIB_POWERTABLE
71 static const float power2[maxpow - minpow + 1];
77 #endif // RANDOMLIB_RANDOMPOWER2_HPP
static RealType pow2(int n)
static RealType shiftf(RealType x, int n)
Return or multiply by powers of 2.