11.001001000011111101101010100010001000 Arithmazium
Home

Case 1

Case 1 arises in arithmetic that flushes underflows to zero. The comment explains that the underflow threshold is backed up to the next power of B if the computation of add_sub_hi cannot be reproduced, indicating some anomaly.

The call to test_tiny_differences() explores whether the differences between unequal values are zero. It applies to all of cases 1-3.

        else:
            # Case 1
            underflow_threshold = base_tiny  # Safe value computed above
            # A sanity check determines that the result from
            # tiny_x_and_difference() matches expectation, based on the
            # loop on powers of B. The factor one_plus_safe accounts for
            # the difference between the tiny_B and tiny_x loops.
            # h_fact accounts for the case that what ought to be the
            # tiniest power of B in the representation is given the value
            # zero. If these don't match, the threshold is backed up a
            # factor of B.
            if ((ONE_OVER_C * add_sub_hi)
                    != ((ONE_OVER_C * less_tiny_B) * one_plus_safe * h_fact)):
                underflow_threshold = less_tiny_B
                bad_cond(err_failure,
                         "Either accuracy deteriorates as numbers\n")
                print("approach a threshold = {:0.17e}"
                      .format(underflow_threshold))
                print(" coming down from {:0.17e}".format(C))
                print(" or else multiplication gets too many ", end="")
                print("last digits wrong.")
                pause()
    # Cases 1-3 fall through to a final test for zero differences.
    test_tiny_differences()
Home