'LogBack% function test bed for _printstring command
dpos% = 400 'we'll line up our decimal points at x=400
'ledger lines
c& = &H7F7F7F7F * (ln% = 0) - &H3F7F007F * (ln% <> 0)
LINE (400 + (ln%
* 8), 0)-(400 + (ln%
* 8), _HEIGHT - 1), c&
'&H7F7F7F7F
'print the number list in columnar fashion
DATA -1000000.0001,-1000000,-999999.999,-999999,-10000,-1000,-50,-10,-5.678,-1,0 DATA 1,4.912,23,99.999,4587.23,12000,999999,1000000,1000001
'²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²
'compute position setback to align (value) decimal points at (decpos)
IF ABS(value
) >= 1 THEN ' back up 8 pixels / decimal place LogBack%
= decpos
- _SHL(INT(LOG(value
* SGN(value
)) / LOG(10.#
)) + 1 - (value
< 0), 3) ELSE ' a fractional value LogBack% = decpos ' start at the decimal place for positive decimal
LogBack% = decpos - 8 ' start 8 pixels behind for zero & negative decimals