Fortran Coder

查看: 10613|回复: 5
打印 上一主题 下一主题

[数值问题] 有关fortran位数取舍问题

[复制链接]

490

帖子

4

主题

0

精华

大宗师

F 币
3298 元
贡献
1948 点

水王勋章元老勋章热心勋章

楼主
发表于 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.)

490

帖子

4

主题

0

精华

大宗师

F 币
3298 元
贡献
1948 点

水王勋章元老勋章热心勋章

沙发
发表于 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.


您需要登录后才可以回帖 登录 | 极速注册

本版积分规则

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

GMT+8, 2024-5-5 04:17

Powered by Tencent X3.4

© 2013-2024 Tencent

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