Mathieu Carbou on Fri, 19 Oct 2012 16:46:39 +0200


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

digits(0)


Hello,

I was coding something relative to digits in base 2 and my code crashed
when the number reached 0 because

digits(0, 2) = []
digits(0, 10) = []

Whereas digits(1,2) = [1]

I was expecting

digits(0, 2) = [0]
digits(0, 10) = [0]

Why 0 does not deserve to be a digit ? In base 2, or b the first
bit/digit is 1*b^0 or 0*b^0 so why it is not in the resulting vector  ?

Thank you :-)

-- 

Mathieu Carbou
Cell: 514-660-4287