MCPcopy Create free account
hub / github.com/Gecode/gecode / pow_dn

Function pow_dn

gecode/third-party/boost/numeric/interval/arith2.hpp:126–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124namespace detail {
125
126template<class T, class Rounding> inline
127T pow_dn(const T& x_, int pwr, Rounding& rnd) // x and pwr are positive
128{
129 T x = x_;
130 T y = (pwr & 1) ? x_ : static_cast<T>(1);
131 pwr >>= 1;
132 while (pwr > 0) {
133 x = rnd.mul_down(x, x);
134 if (pwr & 1) y = rnd.mul_down(x, y);
135 pwr >>= 1;
136 }
137 return y;
138}
139
140template<class T, class Rounding> inline
141T pow_up(const T& x_, int pwr, Rounding& rnd) // x and pwr are positive

Callers 1

powFunction · 0.85

Calls 1

mul_downMethod · 0.45

Tested by

no test coverage detected