> One can convert between decimal and other bases (radices) using bc, by > setting the input or output base: [...] > For more general radix conversion, I use db: to add my own 2 cents, i tend to use a little command-line calculator i wrote ages ago to do this sort of thing. i still prefer it to the above tools because it's not interactive (= less stuff to type to get the results). it's a reverse polish calculator, which works quite well on the command line, as there's almost no punctuation to get in the way of the shell's syntax (no brackets, and the stuff to be executed is just a list of operands/operators, which maps well to rc's lists). it's also handy for building up an expression incrementally. it's very similar to the inferno version, documented at http://www.vitanuova.com/inferno/man/1/fc.html all calculations are done in floating point, and it's a convenient command-line way of getting access to the floating point library, not to mention converting between bases. e.g. % fc 0x400 1024 % fc -x 1024 0x400 % fc 0400 256 % fc -x 0400 0x100 % fc 22 7 / 3.142857143 % x=(1 2 3 4 5 6) % fc $x sum 21 % fc -B 96451234 0b00000101101111111011101010100010 10987654321098765432109876543210 3 2 1 % fc 0b00000101101111111011101010100010 sqrt 9820.958914 % fc -help Usage: fc -[dcxotbB] Option specifies output format: -d decimal -c rune -x hex -o octal -t time -b binary -B annotated binary Operands are decimal(default), hex(0x), octal(0), binary(0b), rune(@), time(hh:mm.ss) Operators are: (number of arguments in brackets) swap[2] dup[1] rep[n] ![1] %[2] p[1] *,×,x[2] **,xx,^,pow[2] +[2] -[2] /[2] _[1] <<,«,shl[2] >>,»,shr[2] and,⋀[2] ⋁,or[2] xor[2] not[1] sum[n] acos[1] asin[1] atan[1] atan2[2] ceil[1] cos[1] cosh[1] deg[1] exp[1] fabs[1] floor[1] fmod[2] ldexp[2] log,ln[1] log10[1] log2[1] rad[1] sin[1] sinh[1] √,sqrt[1] tan[1] tanh[1] trunc[2] Constants are: π=3.14159 pi=3.14159 e=2.71828 % i've attached it. someone might find it useful.