- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The intel fortran compiler works a bit different on Linux and Windows. When read/write a double precision number in its scientific notation without specifying the format, I got different result.
If I just use write(file_out, '(E20.12)')mynumber,
on Linux, the result is 0.000000000000e+00
on Windows the result is 0.000000000000e+000
Is there a way for change the default exponential digits? I mean still use write(file_out, '(E20.12)')mynumber, not change my code to write(file_out, '(E20.12E3)')mynumber.
I am compiling some of my old code on windows, this will save me a lot of trouble. I cannot find a answer. Please tell me how to do it. Thanks.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, it doesn't work differently on Windows and Linux - at least it isn't supposed to. You won't get E+000 unless you use a Ew.dE3 format.
E20.2 will give you E+nn or +nnn if the exponent is three digits - this is specified by the Fortran standard. You may want to look at the G0 or G0.d formats that will use the minimum field width necessary to represent the value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve.
I could not reproduce my previous result within a new project. Yes you are right about the fortran output format. I'll try to find where the problem is located.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page