Re: [OT] GNU bc base conversion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Aug 28, 2015, at 9:50 AM, Gordon Messmer <gordon.messmer@xxxxxxxxx> 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@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos




[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux