tech-userlevel archive

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

Re: silly behavior of factor(6)



    Date:        Thu, 22 Apr 2010 17:37:48 +0000
    From:        David Holland <dholland-tech%NetBSD.org@localhost>
    Message-ID:  <20100422173748.GA909%netbsd.org@localhost>

  | It can easily reject zero like it rejects negative numbers.

Just to be different, personally, I'd just leave the code like it is now,
and instead just document it.

That is, as has been stated, it makes no sense to even consider factoring 0
(I agree it doesn't make much sense to attempt to factor 1 either, but I
don't mind that factor pretends that it can) - so, what's wrong with using 0
as a "quit now" input value?   How much of historical practice it was
in the 4.4 days I'm not sure (I don't recall ever wanting to factor 0 to
encounter the "problem") - but for sure now it is historical practice, 4.4
is (was) a LONG time ago now, and NetBSD's factor has been like this,
more or less, forever...

So, just add something like

        Should factor encounter the dreaded nought, it shall quietly retire
        to its eternal resting place, and certainly factor no more.

kre



Home | Main Index | Thread Index | Old Index