11.001001000011111101101010100010001000 Arithmazium
Home

This is an automatically generated file.

Part 1

Part 2

def no_trap_overflow_threshold(big, less_big):
    """ Determine the threshold when there is no trap on overflow.

    Typically, the search for the threshold will result in bigger_B and
    big_B pinned at Infinity or some huge finite value. Value less_big_B
    is guaranteed to be a finite, unexceptional value. This routine either
    returns big_B as a finite saturating value or fills out less_big_B
    with significant digits to reach right up to big_B.

    Args:
        big: power of 1/H that may be infinite or saturating finite value
        less_big: tame value a nominal factor of H smaller than big

    Returns:
        oflo: the overflow threshold
    """

Part 3

    oflo = -less_big  # default start
    pos_big = -big
    y = less_big * (ONE_OVER_H * ULP_OF_ONE_PLUS - ONE_OVER_H)
    z = y + ((ONE - ONE_OVER_H) * ULP_OF_ONE_PLUS) * less_big
    if z < pos_big:
        oflo = z
        if verbose:
            print("Try full-precision overflow threshold.")
    elif y < pos_big:
        oflo = y
        if verbose:
            print("Try reduced precision overflow threshold.")
    if pos_big - oflo < pos_big:
        oflo = pos_big
        if verbose:
            print("Finite saturating power of B overflow threshold.")
    return oflo


Part 4

Home