On Sun, May 16, 2021 at 02:54:39PM +0200, Otto Moerbeek wrote:
[..]
> > > >Fix:
> > >   Not provided, sorry, I did look at the source code but this seems
> > >   beyond me at first glance, and I'm not even sure if I'm using dc
> > >   right.
> > > 
> > 
> > How can stripping leading zeros lead to a change in value?  They are
> > always implicit and always stripped by dc. Only 0 is printed as 0, not
> > stripping the leading zero because that would lead to an empty string.
> > 
> > You are assuming some form of grouping wil be done. That is not true.
> > Note that 125 is not a multiple of 4.
> > 
> > to illustrate using bc:
> > $ bc
> > obase=16
> > ibase=2
> > 10010110010111110111010010011101110100111010010010100101001001010001111110101011101101010100001000100110010100010010100111001
> > 12CBEE93BA7494A4A3F576A844CA2539
> 
> To phrase it differently, when converting from base 2 to base 16, you
> need to start at the *end*, not the beginning of the string. The
> grouping of 4 base 2 digits to 1 base 16 digit only works since 2^4 ==
> 16.
> 
>       -Otto
> 

OK gotcha.  Thanks Otto!

Best Regards,
-peter

Reply via email to