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

Function pow_up

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

Source from the content-addressed store, hash-verified

138}
139
140template<class T, class Rounding> inline
141T pow_up(const T& x_, int pwr, Rounding& rnd) // x and pwr are positive
142{
143 T x = x_;
144 T y = (pwr & 1) ? x_ : static_cast<T>(1);
145 pwr >>= 1;
146 while (pwr > 0) {
147 x = rnd.mul_up(x, x);
148 if (pwr & 1) y = rnd.mul_up(x, y);
149 pwr >>= 1;
150 }
151 return y;
152}
153
154} // namespace detail
155} // namespace interval_lib

Callers 1

powFunction · 0.85

Calls 1

mul_upMethod · 0.45

Tested by

no test coverage detected