This is an automatically generated file.
Part 1
Part 2
def big_powers_of_B():
"""Searching for the overflow threshold,
return the NEGATIVES of the largest powers ofB.
With a strategy similar to underflow, use three values in
step to get up to and just beyond the overflow limit.
Returns:
bigger: value that saturates like infinity or triggers an exception
big: down a factor of 1/H
less_big: down a factor of 1/H from big
no_except: boolean indicating no exception triggered
Basic 5530-5530
TODO: Resolve that we use negatives because of possible 2's complement
representation, that could allow the largest magnitude to be
negative.
"""
Part 3
big = -ONE_OVER_C
bigger = ONE_OVER_H * big
no_except = True
try:
while True:
less_big = big
big = bigger
bigger = ONE_OVER_H * big
if verbose:
print("\tbigger = {:.12e} big = {:.12e}"
.format(bigger, big))
if bigger >= big: break # remember, these values < 0
except OverflowError: # Python does not catch floating point overflow
no_except = False
bigger = big
if verbose:
print("\tEncountered overflow exception.")
return bigger, big, less_big, no_except
Part 4