11.001001000011111101101010100010001000 Arithmazium
Home

This is an automatically generated file.

Part 1

Part 2

def does_add_sub_have_guard_digit():
    """Check for guard digit in add and subtract.

    Returns:
        boolean reply to question
    """
    x = ONE / (ONE + ULP_OF_ONE_PLUS)
    y = x - ONE_HALF - ONE_HALF
    test_cond(err_serious, y < ZERO, "Computed value of 1/1.000..1 >= 1")

Part 3

    x = ONE - ULP_OF_ONE_PLUS
    y = ONE + B * ULP_OF_ONE_PLUS
    z = x * B
    t = y * B
    r = z / B
    s = t / B
    x = r - x
    y = s - y
    test_cond(err_failure, x == ZERO and y == ZERO,
              "* and/or / gets too many last digits wrong")

Part 4

    y = ONE - ULP_OF_ONE_MINUS
    x = ONE - ONE_MINUS_ULP
    y = ONE - y
    t = B - ULP_OF_ONE_PLUS
    z = B - B_MINUS_ULP
    t = B - t
    gaddsub = ((x == ULP_OF_ONE_MINUS) and (y == ULP_OF_ONE_MINUS)
               and (z == ULP_OF_ONE_PLUS) and (t == ULP_OF_ONE_PLUS))
    test_cond(err_serious, gaddsub,
              "- lacks Guard Digit, so cancellation is obscured")
    return gaddsub


Part 5

Home