Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integer coefficients in Format Fortran90 #216

Closed
tueda opened this issue Jul 10, 2017 · 3 comments
Closed

Integer coefficients in Format Fortran90 #216

tueda opened this issue Jul 10, 2017 · 3 comments

Comments

@tueda
Copy link
Collaborator

tueda commented Jul 10, 2017

I know that for Format Fortran (and DoubleFortran, QuadFortran) an integer coefficient is not translated to a floating-point number (the second term in the following example):

Symbol x;
L F = 1/2 + 2*x;
.sort
Format DoubleFortran;
#write "%e", F
.end
FORM 4.2.0 (Jul  6 2017, v4.2.0) 64-bits         Run: Mon Jul 10 16:23:02 2017

1.D0/2.D0 + 2*x

but this is not the case for Fortran90:

Symbol x;
L F = 1/2 + 2*x;
.sort
Format Fortran90,.0_wp;
#write "%e", F
.end
FORM 4.2.0 (Jul  6 2017, v4.2.0) 64-bits         Run: Mon Jul 10 16:23:35 2017

1.0_wp/2.0_wp + 2.0_wp*x
@vermaseren
Copy link
Owner

This was just brought up in a different way.
A complaint that in expressions like 2/(5+4n) the integers are printed as integers while here it was preferred as 2.D0/(5.D0+2.D0n).
In the versions of 2014 and before this is what it does.
Maybe the best solution is to make a flag that can be set with on/off to select which of these
two systems one prefers. Any comments?

@vermaseren
Copy link
Owner

It seems that in the code there is an option pfortran which is undocumented. It is a bit different in representations, but still not completely sane. It looks like the code there needs at least some commentary and an extension

@tueda
Copy link
Collaborator Author

tueda commented Feb 7, 2019

OK, at least 087a772 can give all-floating-point-number output for DoubleFortran and QuadrupleFortran. Now

    Format Fortran;

1./2. + 2*x
    Format DoubleFortran;

1.D0/2.D0 + 2*x
    Format DoubleFortran;
    Format allfloat;

1.D0/2.D0 + 2.D0*x
    Format QuadrupleFortran;

1.Q0/2.Q0 + 2*x
    Format QuadrupleFortran;
    Format allfloat;

1.Q0/2.Q0 + 2.Q0*x
    Format Fortran90,.0_wp;
	
1.0_wp/2.0_wp + 2.0_wp*x

Other combinations or different ordering would give output that the user may not expect.

tueda added a commit that referenced this issue Nov 7, 2022
- Format allfloat (see also #216)
- Format without line length
- moebius_
- #400
- all example.frm <-> reference manual correspondence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants