John Cremona on Thu, 10 Dec 2015 11:26:44 +0100


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

Re: Regarding digits function


On 10 December 2015 at 10:13, Bill Allombert
<Bill.Allombert@math.u-bordeaux.fr> wrote:
> On Thu, Dec 10, 2015 at 02:35:33PM +0530, chandra sekaran wrote:
>> Hi,
>>
>> digits(0) is giving  empty vector.  It should give [0].
>> Am i correct or wrong?
>
> No, this is expected: this is consistent with binary(0).
> The idea is to remove all leading zeros.

That is certainly the mathematically pure answer, but in Real Life we
strip leading 0s except for 0 itself, since we do not like empty
strings representing integers.

Perhaps the documentation could point this out?

John

>
> Cheers,
> Bill.
>