Source-Changes-D archive

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

Re: CVS commit: src/games/factor

On Sun, May 16, 2010 at 10:49:22PM +0200, Martin Husemann wrote:
 > On Sun, May 16, 2010 at 07:30:54PM +0000, David Holland wrote:
 > > of which at least the 0 case is clearly incorrect...
 > That obviously depends on the meaning you give the output, which is
 > not well defined in the man page and obviously a lot people around
 > here disagree about.
 > I would say the list of prime factors of 0 is empty, so "0:\n" makes
 > perfect sense to me.

Right, but on the other hand (as I mentioned elsewhere) we'd like for
the product of the numbers output to be equal to the number input,
because if that's not true then it cannot be a factorization.

Since there's no set of prime factors whose product is zero, erroring
on zero is a reasonable approach. Printing "0: 0\n", so the product of
the RHS is zero even though it's not a prime factorization, is not
strictly valid but not entirely unreasonable. However, in "0:\n" the
product of the RHS is 1, and that seems undesirable.

David A. Holland

Home | Main Index | Thread Index | Old Index