Avoid starting long uninterruptible computations

Bug: 21957088

Shorten timeouts.

We usually do short computations first, so this helps to avoid
starting absurdly big ones.

Check size of result before converting to decimal.  If the decimal
conversion is likely to time out anyway, just pretent we timed out.
This turns out to avoid a lot of problems, since BigInteger decimal
conversion is the clear bottleneck for something like 100000!
And its uninterruptible.

Remove the timeout in one case in which we had previously forgotten.

Check for interrupts in a couple of more places in BoundedRational.
One of these caused log(10^100000) to hang for a long time.

One or two trivial cleanups in code that was touched anyway.

Change-Id: I3494a8ed28f681fb26634ecd90042e2f2a8008a8
2 files changed