Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Format for real number

Ferdinando_Alde
Beginner
328 Views
Hi all. In the last versions of the Fortran compiler I got a strange result. Using the output format 'F0.4' with a real number = 0.0 the last 3 release generate different results: version 11.1.067 0.0000 version 12.0.0.030 0.0000 version 12.0.2.055 .0000 Where is gone the trailing zero in the last release? I had the same result in VS2008 and VS2010.
0 Kudos
4 Replies
Steven_L_Intel1
Employee
328 Views
You mean the leading zero, right? The new behavior is consistent with the standard, which says, "On output, with I, B, O, Z, F, and G editing, the specified value of the field width w may be zero. In such cases, the processor selects the smallest positive actual field width that does not result in a field filled with asterisks."

Since the leading zero in this case is "optional", the standard requires that it be omitted. I believe that there was an interpretation request regarding this.
0 Kudos
Ferdinando_Alde
Beginner
328 Views

Yes, it is.

Thanks Steve.

There is an option to generate the leading zero?

0 Kudos
Steven_L_Intel1
Employee
328 Views
No, sorry, there isn't.
0 Kudos
DavidWhite
Valued Contributor II
328 Views
You can use the 1P edit descriptor, with care!

For F formating, this changes the value, but not for G formatting, so something like
1PG10.4 ensures you get the leading zero without changing the output value.

regards,

David
0 Kudos
Reply