vermaseren / form

The FORM project for symbolic manipulation of very big expressions
GNU General Public License v3.0
982 stars 118 forks source link

Removing line continuation limit #392

Closed magv closed 2 years ago

magv commented 2 years ago

The docs describe the ContinuationLines option as the following:

ContinuationLines

The number of continuation lines that the local Fortran compiler will allow. This limits the number of continuation lines, when the output option `Format Fortran' (see 7.60) is selected.

This says that there's only a limit on continuation lines when a Fortran output format; this is not so: the limit is there in all formats. Here's an example with C format:

$ cat >test.frm <<EOF
#: ContinuationLines 1
auto symbol x;
local ex = (xabcdefg + xhijklmnop)^200;
print ex;
.sort
format C;
#write <out> "%e" ex
.end
EOF
$ form test.frm
$ cat out
pow(xhijklmnop,200) + 200*xabcdefg*pow(xhijklmnop,199) + 19900*pow(
      xabcdefg,2)*pow(xhijklmnop,198);
      _ +=  + 1313400*pow(xabcdefg,3)*pow(xhijklmnop,197) + 64684950*
      pow(xabcdefg,4)*pow(xhijklmnop,196);
      _ +=  + 2535650040*pow(xabcdefg,5)*pow(xhijklmnop,195) + 
[...]

Here you can see the _ += marks every seconds line; those stem from the line continuation limit.

First of all, I think the documentation should be updated.

Second, would it be possible to have an option to disable this behavior? I'd like to effectively set ContinuationLines to infinity. In pySecDec we have a workaround that specifically recognizes the ; _ += sequences and replaces them with blanks, and I'd like to remove this hack completely. Unfortunately just setting ContinuationLines to a large number is not an option (it will only postpone the problem); it really has to be infinite.