public static DevInt root(DevInt number, DevInt root) { if (number == 0) return 0; Console.WriteLine("number = " + number + "\nroot = " + root); DevInt low = DevInt.root(DevInt.rightShift(number,root), root) << 1; DevInt high = low + 1; Console.WriteLine("low = " + low + "\nhigh = " + high); return DevInt.pow(high, root) > number ? low : high; } root :: Int -> Int -> Int root 0 _ = 0 root n r = let low = (root (r `shiftR` n) r) `shiftL` 1; high = low + 1 in if (high ^ root) > number then low else high