Hi,
On Tue, May 26, 2015 at 10:18:00AM +0200, Jerome BENOIT wrote:
> Hello Julien:
>
> I am now the owner of this bug.
>
> On my side I can reproduce what the former owner said.
> In particular, clearly 1 is a particular factor, so it makes sense
> to make it special, and return a specific value for.
The same source code doesn't give the same result when compiled&run with the
Debian package and with the Sage-compiled package... that's
quite strange, and might indicate something is fishy somewhere.
> According to the header file, whenever there is an error, the return value
> is negative.
There is no error...
> On your side, have you done any progress ?
Yes and no. No, because I still can't pinpoint what happens.
Yes, because I noticed that the code I pasted needs to be compiled like this in
Debian:
gcc -o test test.c -lecm -lgmp
(when run: "No factor found")
while within sage, it's:
gcc -o test test.c -I<cut> -L<cut> -lecl -lgmp -lm
(when run: "1")
You'll notice that the -I and -L switch are normal, since I link against
non-system things. But why the -lm switch?
Snark on #debian-science
PS: here is a more complete version of my sample code (justifies there is no
error):
#include <ecm.h>
int
main(int argc, char *argv[])
{
mpz_t n, f;
int res;
mpz_init(n);
mpz_set_d(n, 1);
mpz_init(f);
res = ecm_factor (f, n, 100, NULL);
if (res == ECM_NO_FACTOR_FOUND)
gmp_printf("No factor found\n");
else if (res == ECM_ERROR)
gmp_printf("ECM_ERROR\n");
else
/* factor.c says ECM_FACTOR_FOUND can be returned...
* but it doesn't exist!
*/
gmp_printf("%Zd\n", f);
return 0;
}
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]