bug-coreutils
[Top][All Lists]
Advanced

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

Re: factor


From: Jim Meyering
Subject: Re: factor
Date: Mon, 03 Oct 2005 19:00:36 +0200

ThMO <address@hidden> wrote:
...
>> -       error (0, 0, _("%s is not a valid positive integer"), quote (s));
>> +       error (0, 0, _("invalid argument: %s"), quote (s_diag));
>
> Why not call this error message:  _("%s is not a valid number")  ?

I agree it's not that great, but `0' is a valid number.
I didn't want to say ``is not a nonzero integer''.
Of course, we could give a separate diagnostic for zero,
but I'm not sure it's worthwhile.

> That way the user immediately knows, that a number is needed.

Maybe we can assume that people who run factor know it requires
an integer argument?

...
> While looking at the sources, I found already a `factorize.c' program under
> the `demos' directory - at least in the archive of the locally installed
> v3.1.1 of the libgmp source tree.
> This library is able to factorize the two examples in the coreutils info-page,
> which are very slow, relatively fast.  After requesting another number, I had
> to stop the execution after 12+ minutes - cross-checking it with pari, it took
> only 191 seconds to factorize the following number:
>   '82710182818190128129228267632297310019018273821100101836627627'
> My still preferred approach in writing a wrapper-script around `gp' will 
> result
> in faster execution - although it might be a speed-up for gfactor to use the
> gmp library.
> Surely it must be investigated, how fast gfactor's algorithm will run using
> libgmp...

No, no, no :-)
I would never suggest using GNU factor's algorithm with libgmp.
There are far better ways.  gmp's factorize.c gives you some ideas,
but there are many more, including probabilistic ones.
In fact, making GNU factor use code like what's in factorize.c
would probably be just fine.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]