11.001001000011111101101010100010001000 Arithmazium
Home

This is an automatically generated file.

Part 1

Part 2

def does_div_have_guard_digit():
    """Check for guard digit in division.

    Returns:
        boolean reply to question
    """
    y = ONE - ULP_OF_ONE_PLUS
    x = ONE + ULP_OF_ONE_PLUS
    z = ONE / y
    y = z - x

Part 3

    x = ONE / THREE
    z = THREE / NINE
    x = x - z

Part 4

    t = NINE / TWENTY_SEVEN
    z = z - t
    gdiv = (x == ZERO) and (y == ZERO) and (z == ZERO)
    test_cond(err_defect, gdiv,
              "Division lacks a Guard Digit, so error can exceed 1 ulp\n"
              + "or  1/3  and  3/9  and  9/27 may disagree")

Part 5

    y = ONE_MINUS_ULP / ONE
    x = ONE_MINUS_ULP - ONE_HALF
    y = (y - ONE_HALF) - x
    x = ONE + ULP_OF_ONE_PLUS
    t = x / ONE
    x = t - x

Part 6

    # JTC: gdiv now includes all 5 tests not just last 4 like original.
    gdiv &= (x == ZERO) and (y == ZERO)
    test_cond(err_serious, gdiv, "Division lacks a Guard Digit, so x/1 != x")
    return gdiv


Part 7

Home