Anonymous user
Non-decimal radices/Convert: Difference between revisions
no edit summary
No edit summary |
|||
Line 172:
Many variants of Forth support literals in some bases, such as hex, using a prefix
$ff . // 255
=={{header|J}}==
J supports direct specification of numbers by base, as in these examples:
2b100 8b100 10b100 16b100 36b100 36bzy
4 64 100 256 1296 1294
The following provide conversion of numeric values to literals, and of literals to numbers.
numerals=: '0123456789abcdefghijklmnopqrstuvwxyz'
baseNtoL=: numerals {~ [ #.^:_1 ]
baseLtoN=: (#~ #) #. numerals i. ]
=={{header|Java}}==
|