I have a Linux PC (Ubuntu) where I installed PARI/GP from the command line (when you type gp
in a shell, it says the program is not there but gives you a command you can use to get it all installed), and then I have a Windows machine where I installed PARI/GP through the self-installing distribution (.exe
) from the PARI/GP home page.
I noticed a difference in the behavior when I interrupt a function call with Ctrl+C
(or Ctrl+Break
). In the Linux version, it comes up with a message like:
*** user interrupt after 358 ms
*** Break loop: <Return> to continue; 'break' to go back to GP prompt
and it allows me to inspect local variables (whose scopes were limited to within the function that was terminated), such as loop variables. However, on my Windows machine it leaves the function completely and goes out to the usual prompt, and there is no way I can see what the state of everything was like just before I pressed Ctrl+C
.
For a contrived example, with code like:
for(i=1,10^30,if(ispseudoprime(i^i+1),print(i)))
on the Ubuntu system, I can break and check the current size of i
and then decide to either stop or go on, while on the other machine, that is not possible.
Why is there this difference between the two installations, and is this something I can configure myself?
(answering my own question)
This is controlled by a so-called default with name breakloop
. You can see its value (which should be either 0
or 1
) from within GP with:
default(breakloop)
and you can change it to a new value with e.g.:
default(breakloop, 1)
On your Linux system, you have no preference file (gprc
file), so the default which is named breakloop
takes its "default" value which is 1
in your use of GP.
On your MS Windows system, on the other hand, the installation comes with a preference file C:\Program Files (x86)\Pari-2-7-2\gprc.txt
in which a line exists:
breakloop = 0
You can remove that line entirely, or comment it out:
\\breakloop = 0
or you can change that 0
into 1
.
Note that when you edit gprc.txt
you will need a text editor that (1) can read text files where the line endings are just LF
(instead of the usual Windows convention CR LF
), and (2) is "run as administrator".