Quote:
Originally Posted by
wisecracker
I don't know dc at all but looked up the man page...
Does it works like this?:-
1) Put, (the decimal value of?), D at the top of the stack.
2) Then pop it off to set the radix, (68?).
3) BBC is the number that becomes...
4) The result [p]opped off of the stack too...
Almost. In
dc, the input radix can be any number in the range 2 through 16. The dc utility isn't in the standards, so I don't know if this is portable or not, but many implementations of dc accept A through F as hex representations of decimal 10 through 15 for the
i command no matter what the current input radix is.
dc keeps separate input and output radix values (and the output radix can be much larger), so setting the input radix to 13 (
Di) or (
13i) and leaving the output radix at the default 10, the command string
BBCp puts
BBC (a number presented in base 13) on the stack and the command
p pops it off of the stack, converts it to the current output base (11*13*13 + 11*13 + 12 -> 2014) and prints it.