This is an automatically generated file.
Part 1
Part 2
# =============================================
# Tests for normalization, guard digit, rounding, use of a sticky bit.
# =============================================
def test_normalized_subtraction():
"""Test for renormalization on magnitude subtraction.
Computes 1.0 via cancellation of two large values. Then adds
a tiny increment that would be rounded off were the value 1.0
not normalized after the subtraction.
"""
Part 3
if (B >= TWO):
x = BIG_B_NTH / (B * B)
y = x + ONE
z = y - x
t = z + ULP_OF_ONE_PLUS
x = t - z
if x == ULP_OF_ONE_PLUS:
print("Subtraction appears to be normalized, as it should be.")
else:
test_cond(err_failure, False,
"Subtraction is not normalized x=y,x+z != y+z!")
return
Part 4