About the default precision of exponential part when read/write

About the default precision of exponential part when read/write

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.

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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.

Steve - Intel Developer Support

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.

Leave a Comment

Please sign in to add a comment. Not a member? Join today