- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, it is.
Thanks Steve.
There is an option to generate the leading zero?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, sorry, there isn't.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page