I assume you should use floor division to preserve accuracy. As a
numerical example, say you want the first 100 /decimal/ digits of 3 /
173. That's the same as floor(10^100 * 3 / 173).
In [105]: from decimal import Decimal, getcontext
...: getcontext().prec = 300
...: print(10**100 *
Given SR constant, I want to extract the first L base B digits
of the fractional part.
So far the best solution I found is:
floor((SR(expression)*B**L).numerical_approx(digits=L)).digits(B)
Can I do better?
Why the following approach fails numerically:
```
def base_B_digits(A, B,prot=False):