Processing math: 100%
11.001001000011111101101010100010001000 Arithmazium
Home

find_radix_from_big_2_to_nth()

This function's argument is the result from find_big_2_to_nth(). The low-order digit in big is in the B's place, that is the 2's place in binary, the 10's place in decimal, and so on.

def find_radix_from_big_2_to_nth(big):
    """The radix is marked by a change in the 'tens' place.

    Args:
        big: smallest value satisfying |((big + 1) - big) - 1| >= 1

    Returns:
        radix, which may not be integral in log arithmetic
    """

The loop simply adds the values 1, 2, 4, 8, ... in sequence until b exceeds big. In binary, this will happen on the first or second step, but the result is the same.

b = big + y # y = 1    100 ... 001 VAX add-half-and-chop will round this up b = big + y # y = 2    100 ... 010 Add's into the 2's place, giving the radix

In decimal, the low order digit will change when y is 8 or 16, depending on whether the arithmetic is rounded or chopped.

b = big + y # y = 4    xx ... xz4 Most arithmetics would round the 4 down b = big + y # y = 8    1xx ... xz8 Modern decimal arithmetic would round into the z digit b = big + y # y = 16    1xx ... xZ6 In chopped arithmetic this bumps z to Z = z + 1 possibly with a carry into the next digit

The digits x and z depend on the decimal precision, but the algorithm applies, regardless.

    y = ONE
    while True:
        b = big + y
        y = y + y
        b = b - big
        if b != ZERO: break
    return b


Home