This is an automatically generated file.
Part 1
Part 2
def test_for_pseudo_zero(pseudo):
"""Test for a nonzero value that violates basic numerical laws.
Args:
pseudo: tiny value that might misbehave
Basic 4580-4630
"""
Part 3
if (pseudo == ZERO):
return
print("")
# Test pseudo for "phoney-zero" behavior, violating either
# pseudo < tiny_x or pseudo < pseudo + pseudo
# These are the loop termination tests in tiny_values_and_difference().
if (pseudo <= ZERO):
bad_cond(err_failure, "Positive expressions can underflow to an " +
"allegedly negative value\n")
print("pseudo that prints out as: {:g} .".format(pseudo))
x = -pseudo
if x <= ZERO:
print("But -pseudo, which should be", end="")
print("positive, isn't; it prints out as {:g} ."
.format(x))
Part 4
else:
bad_cond(err_flaw, "Underflow can stick at an allegedly positive\n")
print("value pseudo that prints out as {:g} ."
.format(pseudo))
# One final test for strangeness around the underflow threshold.
# The test is made just for the side-effects, not the reulst value.
discard = does_tiny_value_misbehave(pseudo)
return
Part 5