io - 使用英特尔 Fortran 编译器避免列表导向输出中的换行符

我注意到 Fortran 中的列表导向输出 write(*,*) 的结果是依赖于编译器的。

确实,用代码:

program one
real(8), dimension(5):: r1
do i=1,5
    r1(i)=sqrt(i*10.0)
end do
write(*,*) (r1(i), i =1,5)
end program one

intel 编译器 ifort 给出标准输出,被换行符打破:

   3.16227769851685        4.47213602066040        5.47722530364990     
   6.32455539703369        7.07106781005859     

而 gfortran 给出了等效的一行结果:

    3.1622776601683795        4.4721359549995796        5.4772255750516612        6.3245553203367590        7.0710678118654755     

我认为 ifort 每行最多写 3 个项目(当 float 实数时)。 有什么方法可以使 ifort 输出像 gfrotran 一样,即避免换行符? 理想情况下,我想保留列表导向的输出 (*,*) 指令,所以我正在寻找类似编译器选项的东西,如果有的话。

最佳答案

从第 14 版开始,intel fortran 编译器具有 wrap-margin 功能。默认情况下,记录在 80 个字符后换行。要禁用此限制,您应该指定:

在 Linux 上:-no-wrap-margin

在 Windows 上:/wrap-margin-

在 Intel Fortran's reference guide 上查看更多信息

https://stackoverflow.com/questions/17407232/

相关文章:

java - 从java中的字符串解析带有正/负前缀的数字

java - 将 lenient 设置为 false 时的 SimpleDateFormat 异常

excel - 条件格式 : making cells colorful

python - Python中的十进制对齐格式

python - 在 Python Pandas DataFrame 或 Jupyter Noteb

c# - Visual Studio/ReSharper 代码格式化 - C#

mysql - MySQL中的字符串格式化

c# - 解释令人困惑的条件字符串格式

javascript - Kendo UI 货币格式

excel - Vba检查单元格中是否部分粗体