leading zero in 3(G) format, there or not

leading zero in 3(G) format, there or not

I'm writing floating point data to a text file with a (G) format and for a number like 0.12345 the presence of a leading zero depends on whether I'm running the program from a DOS command line or running it from inside the visual studio debugger.  Is this supposed to happen?

9 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

No, and I think you're not properly explaining what you are seeing.  Small but complete code example, please, with sample output in both cases.

Steve

WRITE(90,'(3(G))') xi2, xi*30.D0/DPI, xi/2.D0/DPI
This produces:
0.9251200198775795 588.6800268942104 9.811333781570173
with or without the leading zero on the first value depending on whether I'm running from the debugger or in a dos window.
Unit 90 is an open text file.

Depending on the attributes used to OPEN the file and compiler options such as /vms, ASA carriage control may be in play. That would explain why a leading '0' character would cause the program to output a blank line followed by the rest of the record.

Is xi2 computable from xi?

Please show a complete program and also show the compile options used. I would also discourage you from using "G" with no width as that is non-standard. You could use G0, maybe with a 1X after the G0. Are you running the same executable in both environments or recompiling? Show options in both cases.

Fortran carriage control is not on by default, but Intel Fortran generally doesn't add a leading zero when F format is in effect. Maybe you're running an executable built by some other compiler?

Steve

I replied with more information, but the forum lost my post. Or did it? I seem to have a lot of trouble with this.

It's possible the post got held for moderation - we're working to improve that. Use "Send Author A Message" to send it to me if you want,

Steve

I see now I could have been a little more explicit. The leading zero that I'm talking about is in front of the decimal point of 0.123, not at the start of the line. This is not a big deal. I was mostly surprised to see the program producing different output inside and outside the debugger.

I'm still looking for a test case I can build and run myself. There should not be a difference.

Steve

Connectez-vous pour laisser un commentaire.