Fortran Coder

有关fortran位数取舍问题

查看数: 10835 | 评论数: 5 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2017-12-11 15:27

正文摘要:

不知道怎么设置才能正确读写啦问题如图所示 设置了kind=8或kind=16都一样, 感觉是设置的问题 希望大神解答 谢谢

回复

一路有我 发表于 2017-12-13 17:09:25
vvt 发表于 2017-12-12 13:17
a=-14099.409813d0

a=-14099.409813_8

谢谢啦,我按第二种解决的
一路有我 发表于 2017-12-13 17:08:44
pasuka 发表于 2017-12-12 10:33
本站的教学视频都看过了?
看过三遍还是一知半解,那是教学视频做得不好;一遍都没看过,那是lz人生的重大 ...

谢谢啦,看过该网站视频啦,可能看的不够仔细,我会再看的
pasuka 发表于 2017-12-13 09:32:32
补充一个gfortran的四精度扩展支持
https://gcc.gnu.org/onlinedocs/g ... l#Q-exponent-letter
6.1.8 Q exponent-letter
GNU Fortran accepts real literal constants with an exponent-letter of Q, for example, 1.23Q45. The constant is interpreted as a REAL(16) entity on targets that support this type. If the target does not support REAL(16) but has a REAL(10) type, then the real-literal-constant will be interpreted as a REAL(10) entity. In the absence of REAL(16) and REAL(10), an error will occur.


vvt 发表于 2017-12-12 13:17:58
a=-14099.409813d0

a=-14099.409813_8
pasuka 发表于 2017-12-12 10:33:51
本站的教学视频都看过了?
看过三遍还是一知半解,那是教学视频做得不好;一遍都没看过,那是lz人生的重大遗憾!
言归真正:
首先,小数点后的第二位就有差别,岂能熟视无睹?
其次,硬件与编译器是否支持呢?
https://gcc.gnu.org/onlinedocs/g ... 005fFORTRAN_005fENV
REAL32, REAL64, REAL128:
Kind type parameters to specify a REAL type with a storage size of 32, 64, and 128 bits. It is negative if a target platform does not support the particular kind. (Fortran 2008 or later.)

REAL_KINDS:
Default-kind integer constant array of rank one containing the supported kind parameters of the REAL type. (Fortran 2008 or later.)

捐赠本站|Archiver|关于我们 About Us|小黑屋|Fcode ( 京ICP备18005632-2号 )

GMT+8, 2024-11-24 01:54

Powered by Tencent X3.4

© 2013-2024 Tencent

快速回复 返回顶部 返回列表