|
IF P% P% = LOGP%/LOG2+1.5
IF P% P% = LOGP%/LOG2+1.5 REM convert from bit position to number. Uses log theory to convert from a number to the base 2 to a number base 10 REM say P% was %10000 or 2^5 this needs to be converted to 5. Log to the base 2 would give us that. REM but we have log to base 10 function available. So Log N to base 2 = log N to base 10 / log 2 to base 10 REM The +1.5 is 0.5 to avoid a rounding error as we place the result in to an integer, and 1 to get the right ASCII code below.
PRINT "Test"