(%i1) load("f90");
(%i2) f90(long_expression_with_exponent);
sometimes results in the fortran lines being broken in the middle of an exponent. For example if e**x overlaps the end of a line, it is split like this:
e* &
*x
This makes the gfortran compiler fail, I'm not sure if other compilers accept an exponent being continued across two lines.
The work-around is to manually edit the output so it looks like this:
e*&
&*x
which makes gfortran happy, and it compiles away.
It would be nice if f90() could be modified so it wouldn't split lines in the middle of exponents, not sure how much work this would be.
Thanks for your attention.
Forgot to put the version, I'm using Maxima version 5.16.3 that's packaged with Fedora 10.
Hi, I'm working on this. About line continuations for Fortran 90, it appears there are various forms. Jstults, is it OK with you if the lines have a trailing ampersand and no leading ampersand? Like this:
x = a*b*c*d*&
*2+y+z
Gfortran seems to accept that but there seems to be some variation among compilers and I don't know what's common. Thanks for any information. Robert Dodier
That would be fine; gfortran is the compiler I usually use. The other is the intel compiler; I'll be away from my workstation with that compiler for a while so I can't test to see if what you've written works for that one.
Thanks for your attention to this, I really appreciate the f90() facility in maxima.
I've committed r.16 share/contrib/f90.lisp which splits long lines to a fixed width and appends the & continuation character. E.g.:
foo = yyy**4+4*xxx*yyy**3+28*yyy**3+6*xxx**2*yyy**2+84*xxx*yyy**2&
+294*yyy**2+4*xxx**3*yyy+84*xxx**2*yyy+588*xxx*yyy+1372*yyy+xxx**&
4+28*xxx**3+294*xxx**2+1372*xxx+2401
Let me know if that doesn't work. Closing this report as fixed.