Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
18
Task/Binary-digits/Forth/binary-digits.fth
Normal file
18
Task/Binary-digits/Forth/binary-digits.fth
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
\ Forth uses a system variable 'BASE' for number conversion
|
||||
|
||||
\ HEX is a standard word to change the value of base to 16
|
||||
\ DECIMAL is a standard word to change the value of base to 10
|
||||
|
||||
\ we can easily compile a word into the system to set 'BASE' to 2
|
||||
|
||||
: binary 2 base ! ;
|
||||
|
||||
|
||||
\ interactive console test with conversion and binary masking example
|
||||
|
||||
hex 0FF binary . cr
|
||||
decimal 679 binary . cr
|
||||
|
||||
binary 11111111111 00000110000 and . cr
|
||||
|
||||
decimal
|
||||
Loading…
Add table
Add a link
Reference in a new issue