| 226 | namespace detail { |
| 227 | |
| 228 | template< class I > inline |
| 229 | I root_aux(typename I::base_type const &x, int k) // x and k are bigger than one |
| 230 | { |
| 231 | typedef typename I::base_type T; |
| 232 | T tk(k); |
| 233 | I y(static_cast<T>(1), x, true); |
| 234 | for(;;) { |
| 235 | T y0 = median(y); |
| 236 | I yy = intersect(y, y0 - (pow(I(y0, y0, true), k) - x) / (tk * pow(y, k - 1))); |
| 237 | if (equal(y, yy)) return y; |
| 238 | y = yy; |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | template< class I > inline // x is positive and k bigger than one |
| 243 | typename I::base_type root_aux_dn(typename I::base_type const &x, int k) |