If you have the chance to modify the code I think it would be much more readable to use a plain F9.5 and explicitly divide the variable by 100000, something like:

k=810000

...

WRITE(*,'(F9.5)') REAL(k)/100000.

Solved

Posted on 2012-09-20

I am working with Fortran 77 and Fortran 90 code, some of which is converted and some that is melded together. I have come across a formatting descriptor that I can not find anywhere in any reference. Generally, it seems to be used for an integer conversion. For example, a variable containing the number 810000 (as an integer) is written out to obtain 8.10000 as a result using dfloat, but the descriptor is -5PF9.5. I cannot find any information anywhere as to what the -5 or the P means. I know, for instance, if it had been 2F5.2, it would mean to repeat 5.2 twice, but the -5PF9.5 is not the same and I'm baffled as to where this comes from. I'm guessing that the -5 has something to do with the decimal being inserted 5 places to the left (in this case), but why the 'P'? Does anyone have any insight into the '-5P' portion here? I've seen different negative numbers, but there is always a P.

3 Comments

If you have the chance to modify the code I think it would be much more readable to use a plain F9.5 and explicitly divide the variable by 100000, something like:

k=810000

...

WRITE(*,'(F9.5)') REAL(k)/100000.

RATE is declared as REAL*4, ECURRT is an INTEGER*4 (although I don't think that would matter here.

RATE=ECURRT/100000

WRITE(lu02,"(F9.5)")RATE

where ECURRT=810000, but my output (RATE) is 8.00000 instead of the expected 8.10000, so of course it is throwing my calcuation off. Any idea why it isn't translating all the digits?

Incidently, also tried RATE=REAL(ECURRT/100000)

UPDATE - had the parentheses wrong, tried RATE=(ECURRT)/100000 and it worked just fine. Thank you so much.

By clicking you are agreeing to Experts Exchange's Terms of Use.

The purpose of this article is to demonstrate how we can use conditional statements using Python.

Join the community of 500,000 technology professionals and ask your questions.

Connect with top rated Experts

**17** Experts available now in Live!