Anonymous user
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 (
/*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
unfog=b2d(101) /*there's no
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)))
b2d: return x2d(b2x(arg(1)))
b2c: return x2c(b2x(arg(1)))
c2b: return word(strip(x2b(c2x(arg(1)))
=={{header|Ruby}}==
|