On Aug 28, 2015, at 9:50 AM, Gordon Messmer <gordon.mess...@gmail.com> wrote:
> 
> On 08/28/2015 07:15 AM, Mike - st257 wrote:
>> Thoughts as to why my BC functions aren't properly converting between bases?
>> 
>> Decimal to binary or hex works fine, but not binary or hex to decimal and
>> so forth.
> 
> I'm not an expert in bc, so I might be wrong, but it looks like setting the 
> ibase inside a function is simply too late.  ibase affects how bc interprets 
> input.

Yes, and it’s a serious design mistake in bc, IMHO.  No other programmable 
system I’ve ever used changes how numbers in program text are interpreted based 
on prior commands to the system.

I wrote a long answer explaining this on the Unix & Linux Stack Exchange here:

  http://unix.stackexchange.com/a/199620
_______________________________________________
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos

Reply via email to