11.001001000011111101101010100010001000 Arithmazium
Home

This is an automatically generated file.

Part 1

Part 2

def does_mult_have_guard_digit():
    """Test for a guard digit in mulitiplicaiton.

    Run three tests, 1*X and X*1 for X with nonzero low-order
    digit, and a product known to require one extra digit, before
    normalization.

    Returns:
        boolean answer to the question
    """

Part 3

    print("\nChecking for guard digit in *, /, and -.")
    y = ONE_MINUS_ULP * ONE
    z = ONE * ONE_MINUS_ULP
    x = ONE_MINUS_ULP - ONE_HALF
    y = (y - ONE_HALF) - x
    z = (z - ONE_HALF) - x
    x = ONE + ULP_OF_ONE_PLUS
    t = x * B
    r = B * x
    x = t - B
    x = x - B * ULP_OF_ONE_PLUS
    t = r - B
    t = t - B * ULP_OF_ONE_PLUS
    x = x * (B - ONE)
    t = t * (B - ONE)
    gmult = (x == ZERO) and (y == ZERO) and (z == ZERO) and (t == ZERO)
    test_cond(err_serious, gmult, "* lacks a Guard Digit, so 1*x != x")
    return gmult


Part 4

Home