search for: ch49_03

Displaying 1 result from an estimated 1 matches for "ch49_03".

2015 Aug 28
2
[OT] GNU bc base conversion
...rom the CLI and the right values are returned, I have to wonder. Other than a few other define statements, the only other option I have set is scale=5 in my bcrc. In reference to the order of (o|i)base parameters, I have specified obase before ibase [0]. [0] http://docstore.mik.ua/orelly/unix/upt/ch49_03.htm See below for my examples. Thanks! ]$ echo "bin_to_dec(1001)" | bc 1001 # should be decimal 9 ]$ echo "obase=10; ibase=2; 1001" | bc 9 ]$ grep bin_to_dec ~/.bcrc define bin_to_dec(b) { obase=10; ibase=2; return b; } ---- ]$ echo "hex_to_dec(AB)" | bc 99 # s...