Package: pari
Version: 2.7.1
Dear Developers:
First, I would like to thank the developers to provide the excellent pari/gp.
This is a bug report of pari/gp (or clang).
--------
Large negative powers of Mod are wrong.
--------
Macbook Pro (17-inch, Early 2011)
OS X Mavericks ver.10.9.2.(13C1021)
Compiler: Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix
--------
---- Incorrect Result (ver.2.7.1 compiled with clang) ----
GP/PARI CALCULATOR Version 2.7.1 (released)
i386 running darwin (x86-64/GMP-5.0.1 kernel) 64-bit version
compiled: May 24 2014, Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
threading engine: single
(readline v6.2 enabled, extended help enabled)
Copyright (C) 2000-2014 The PARI Group
PARI/GP is free software, covered by the GNU General Public License, and comes
WITHOUT ANY WARRANTY WHATSOEVER.
Type ? for help, \q to quit.
Type ?12 for how to get moral (and possibly technical) support.
parisize = 8000000, primelimit = 500000
? Mod(3,7)^(-100000000000000000000)
*** _^_: Warning: Mod(a,b)^n with n >> b : wasteful.
%1 = Mod(4, 7)
? 1/Mod(3,7)^(100000000000000000000)
*** _^_: Warning: Mod(a,b)^n with n >> b : wasteful.
%2 = Mod(2, 7)
---------------------------
---- Correct Result (ver.2.3.5 compiled with gcc) ----
GP/PARI CALCULATOR Version 2.3.5 (released)
i386 running darwin (x86-64/GMP-5.0.1 kernel) 64-bit version
compiled: Mar 23 2011, gcc-4.2.1 (Apple Inc. build 5664)
(readline v6.2 enabled, extended help not available)
Copyright (C) 2000-2006 The PARI Group
PARI/GP is free software, covered by the GNU General Public License, and
comes WITHOUT ANY WARRANTY WHATSOEVER.
Type ? for help, \q to quit.
Type ?12 for how to get moral (and possibly technical) support.
parisize = 8000000, primelimit = 500000
? Mod(3,7)^(-100000000000000000000)
*** Warning: large exponent in Mod(a,N)^n: reduce n mod phi(N).
%1 = Mod(2, 7)
? 1/Mod(3,7)^(100000000000000000000)
*** Warning: large exponent in Mod(a,N)^n: reduce n mod phi(N).
%2 = Mod(2, 7)
----------------------------
I think that this bug is caused by installing with clang
because the old gp2.3 compiled with gcc returns the correct answer.
(The former example is incorrect and the latter, correct.)
I'd like to fix this bug without using gcc, if possible.
Sincerely.