bc has a bug i think ?!

Asked by Habib Tamala on 2009-07-04

when executing this command on my ubuntu jaunty terminal with the bc program v1.06.94 i have an appropriate ouput result, here is: (i took 111101101 as an example)

echo "ibase=2;obase=10;111101101" | bc

expecting 493 as result but the program just reprint my input within the same base, I tried to interchange the order of defining the varaiables ibase and obase and that works fine even when i omit the definition of obase (i know its base 10 by default). its the same problem even if i enter bc and then declare my variables

Question information

English Edit question
bc Edit question
No assignee Edit question
Solved by:
Habib Tamala
Last query:
Last reply:
Revision history for this message
Habib Tamala (drpyro) said :

well explained by Jonathan Marsden !! it's a bug in my logical examination of the situation rather than a real bug, who cares !! i'll be more responsible for what I report next time i'll promise..
many thanks to Jonathan Marsden !!

Revision history for this message
Habib Tamala (drpyro) said :

echo "ibase=2;obase=1010;111101101" | bc should provide the expected result !! the hint is that i already set the input base as binary so i might stick with that when setting obase !! it's the world of interpreters so welcome