Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,28 @@
|
|||
PRINT " 0 (decimal) -> " FNtobase(0, 16) " (base 16)"
|
||||
PRINT " 26 (decimal) -> " FNtobase(26, 16) " (base 16)"
|
||||
PRINT "383 (decimal) -> " FNtobase(383, 16) " (base 16)"
|
||||
PRINT " 26 (decimal) -> " FNtobase(26, 2) " (base 2)"
|
||||
PRINT "383 (decimal) -> " FNtobase(383, 2) " (base 2)"
|
||||
PRINT " 1a (base 16) -> " ;FNfrombase("1a", 16) " (decimal)"
|
||||
PRINT " 1A (base 16) -> " ;FNfrombase("1A", 16) " (decimal)"
|
||||
PRINT "17f (base 16) -> " ;FNfrombase("17f", 16) " (decimal)"
|
||||
PRINT "101111111 (base 2) -> " ;FNfrombase("101111111", 2) " (decimal)"
|
||||
END
|
||||
|
||||
DEF FNtobase(N%, B%)
|
||||
LOCAL D%,A$
|
||||
REPEAT
|
||||
D% = N% MOD B%
|
||||
N% DIV= B%
|
||||
A$ = CHR$(48 + D% - 39*(D%>9)) + A$
|
||||
UNTIL N% = FALSE
|
||||
=A$
|
||||
|
||||
DEF FNfrombase(A$, B%)
|
||||
LOCAL N%
|
||||
REPEAT
|
||||
N% *= B%
|
||||
N% += ASC(A$) - 48 + 7*(ASCA$>64) + 32*(ASCA$>96)
|
||||
A$ = MID$(A$,2)
|
||||
UNTIL A$ = ""
|
||||
= N%
|
||||
Loading…
Add table
Add a link
Reference in a new issue