We'll use these values throughout the rest of the code.
B_MINUS_ULP
is the next value smaller than
the radix. The diagram expands the code to show how
decrementing B
allows the subtraction to be
carried out entirely within PRECISION digits.
It should be exact on any machine that survives the tests
that follow.
Value C
is a tiny value at least a factor of
B**PRECISION
above values that can underflow to
zero or subnormal numbers. Refer to the function for more
color.
milestone = 25 # ==============================
# ... B_MINUS_ULP = nextafter(B, 0)
B_MINUS_ULP = B - ONE
B_MINUS_ULP = (B_MINUS_ULP - ULP_OF_ONE_PLUS) + ONE
# A = 2 if B = 2**k or arithmetic is logarithmic; it's 10 if B=10
# C = 1/B**k not too close to underflow, useful for over/underflow analysis.
# H = min(1/B, 1/2).
A, ONE_OVER_A = compute_A_and_inverse(B)
C, ONE_OVER_C = compute_C_and_inverse()
H, ONE_OVER_H = compute_H_and_inverse()
SAFE_ULPS_OF_ONE = compute_safe_ulps_of_one() # 1 or B ulps of one
Exercise: Compute B_MINUS_ULP
in binary arithmetic, given the helpful start.