-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
On 27/05/15 21:23, Julien Puydt wrote:
> 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")
On my box:
ldd /usr/lib/libecm.so
linux-vdso.so.1 => (0x00007fff1adff000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f86edf38000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f86edbad000)
/lib64/ld-linux-x86-64.so.2 (0x00007f86ee44a000)
So my understanding/guessing is that libecm brings the math library with it (or
something).
Can you compare the config.log files ?
>
> while within sage, it's:
>
> gcc -o test test.c -I<cut> -L<cut> -lecl -lgmp -lm
^^^^
is it a typo ?
>
> (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;
> }
> ECM_NO_FACTOR_FOUND
You can complicate it by printing errno: I get 22 when (res ==
ECM_NO_FACTOR_FOUND)
Thanks,
Jerome
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQEcBAEBAgAGBQJVZiQ1AAoJEIC/w4IMSybj2VcIAK+qjapCQWjsBzvXteFBjEHe
qPrjA/TvTFGpWleiMgRl1QN3mYOzHKVt1NuUtZdEAcYNqS+ckdbqgqgnu49HsT1E
na2rrzCVAe1n85s19za632EajFf5RY7Uk650cWdBifVsW9LAQ9L2/ypJUjv85neR
7Df8M0kqrUcc6pYIQf8x/nLQ4qUnOo0haNBq4ESjyZxXjObgMFSmOjMGmPy/glPO
3AGjC9zhKrtg/1oveoD+iGXvk4a021Wy3Nk9hYliYJERtQPjvHE7vXPdBO+KIBSI
RlwP31WkBCseHv9Lvis5vihhgn+mOJvhJSWd7pD5/C/IZKCaTZa5r1L3htRMIZ8=
=8PL9
-----END PGP SIGNATURE-----
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]