tech-userlevel archive

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

Re: silly behavior of factor(6)



I'm currently inclined to change it to error on 0, print a leading -1
for negatives, and leave the rest alone...
-1 isn't a prime factor. "Unless it is." I'll let this speak for itself as to the can of worms opened by introducing x<1 as input without having factor.6 contain a lesson in number fields. Please, please keep input in N.

And 1 has no prime factors either. That's great, but the whole point
of this thread is to strike a balance between what's strictly
meaningful and what makes the most ad hoc sense.

I agree, so "1: " makes sense (it has no prime factors). But printing anything next to "0: " is wrong (it has infinite prime factors), and printing anything next to "-x: " is misleading unless the operator has a good grounding in theory. By simply saying "numbers x>0", all of this goes away and we can be both mathematically correct /and/ simple.

Home | Main Index | Thread Index | Old Index