tech-userlevel archive

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

Re: silly behavior of factor(6)



On Tue, Apr 27, 2010 at 05:07:10PM -0400, Matthew Mondor wrote:
> On Tue, 27 Apr 2010 20:19:05 +0000
> David Holland <dholland-tech%netbsd.org@localhost> wrote:
> 
> > I fixed the man page the other day to match the current behavior.
> > However, the first issue you see is because of getopt; factor -- -10
> > behaves as expected.
> 
> Hmm I wonder why getopt(3) is used at all if factor(6) supports no options
> whatsoever...

To follow the standard so that options can be added in the future.

FWIW, my thoughs is that the product of the numbers on the RHS (of the
result) should be equal to the value on the left.

This would mean that all these are possible valid answers:
0:
0: 0
1: 1

Also, since a prime multiplied by a unit is also a prime, these are ok:
-30: -2  3  5
-30:  2 -3  5
-30:  2  3 -5
-30: -2 -3 -5
are also valid - although a single -ve prime as the first entry is
probably best.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index