Non-decimal radices/Input: Difference between revisions

Added zkl
m (Results added, and a declaration.)
(Added zkl)
Line 1,031:
00ABCD12
-3141.59000
</pre>
 
=={{header|zkl}}==
The compiler knows numbers like 0x123, 0b1|101, 0d1_000 but the number conversion functions don't.
<lang zkl>fcn b2b(base){
ns:=[20..30].pump(List,T("toString",base));
ns.println();
ns.pump(List,T("toInt",base)).println("\n")
}
b2b(2); b2b(16); b2b(19);</lang>
Print 20 .. 30 in binary, hex & base 19 (or any base 2 .. 32) and parse them to decimal:
{{out}}
<pre>
L("10100","10101","10110","10111","11000","11001","11010","11011","11100","11101","11110")
L(20,21,22,23,24,25,26,27,28,29,30)
 
L("14","15","16","17","18","19","1a","1b","1c","1d","1e")
L(20,21,22,23,24,25,26,27,28,29,30)
 
L("11","12","13","14","15","16","17","18","19","1a","1b")
L(20,21,22,23,24,25,26,27,28,29,30)
</pre>
 
Anonymous user