This is a bit of an academic exercise. I'm implementing a sqrt function in Python. Here's my code,

```
def mySqrt(x):
    low, high = 1, x
    while low < high:
        mid = low + (high - low)/2
        if mid * mid > x:
            high = mid - 1
        elif mid * mid < x:
            low = mid
        else:
            return mid
    return low

```

The issue is that this doesn't work when the number isn't a perfect square.
I want to redesign this function still using the log n complexity which would return the value of the sqrt to a specified number of decimal places.
So it's something like,

```
def sqrt(num, param):
    pass

```

thus

```
sqrt(5, 2) = 2.41
sqrt(5, 3) = 2.414 

```

Can someone help me with this. Thanks.