Non-decimal radices/Input: Difference between revisions

→‎{{header|REXX}}: adjusted two subroutines to not depend on NUMERIC DIGITS. -- ~~~~
m (→‎{{header|REXX}}: simplified two subroutines. -- ~~~~)
(→‎{{header|REXX}}: adjusted two subroutines to not depend on NUMERIC DIGITS. -- ~~~~)
Line 763:
i=right(777.123,3)
j=12 + ' 3 '
k=0000000123.0000/1 /*divison "normalizes the number (--->───► 123)*/
 
/*parsing then, of a decimal number is no */
Line 816:
cyanK=x2b(fab) /*converts a hexadcimal string to binary. */
 
befog=d2b(144) /*there's no dec-->binarydec──►binary, but see below.*/
unfog=b2d(101) /*there's no bin-->decimalbin──►decimal, but see below.*/
 
do j=0 to 27 /*show some simple low-value conversions. */
say right(j,2) 'in decimal is' d2b(j) "in binary and" d2x(j) 'in hex.'
end /*j*/
 
exit /*stick a fork in it, we're done.*/
/*────────────────────────────add these subroutines to end─of─program. */
d2b: return word(strip(x2b(d2x(arg(1)))+,'L',0) 0,1) /*with this subroutine, convert dec──►bin */
b2d: return x2d(b2x(arg(1))) /* " " " /*convert bin──►dec */
b2c: return x2c(b2x(arg(1))) /* " " " /*convert bin──►chr */
c2b: return word(strip(x2b(c2x(arg(1)))+,'L',0) 0,1) /* " " " convert chr──►bin */</lang>
 
=={{header|Ruby}}==