“real*8"是什么意思?意思是? [英] What does "real*8" mean?
问题描述
用 Fortran 90 编写的程序手册说:所有实变量和参数都以 64 位精度指定(即 real*8
)."
The manual of a program written in Fortran 90 says, "All real variables and parameters are specified in 64-bit precision (i.e. real*8
)."
根据Wikipedia,单精度对应32位精度,而双精度对应64 位精度,所以显然程序使用双精度.
According to Wikipedia, single precision corresponds to 32-bit precision, whereas double precision corresponds to 64-bit precision, so apparently the program uses double precision.
但是 real*8
是什么意思呢?
But what does real*8
mean?
我认为 8
的意思是小数点后有 8 位数字.但是,Wikipedia 似乎说单精度通常提供 6-9 位,而 双精度 通常提供 15-17 位数字.这是否意味着64位精度"语句与real*8
不一致?
I thought that the 8
meant that 8 digits follow the decimal point. However, Wikipedia seems to say that single precision typically provides 6-9 digits whereas double precision typically provides 15-17 digits. Does this mean that the statement "64-bit precision" is inconsistent with real*8
?
推荐答案
8指的是数据类型使用的字节数.
The 8 refers to the number of bytes that the data type uses.
所以一个 32 位整数是 integer*4
沿着相同的行.
So a 32-bit integer is integer*4
along the same lines.
快速搜索发现 本 Fortran 数据类型指南,其中包括:
A quick search found this guide to Fortran data types, which includes:
real*4"语句将变量名称指定为单精度 4 字节实数,精度为 7 位,幅度范围为 -38 到 +38 的 10.在几乎所有 32 位计算机中,real"语句与real*4"语句相同.
The "real*4" statement specifies the variable names to be single precision 4-byte real numbers which has 7 digits of accuracy and a magnitude range of 10 from -38 to +38. The "real" statement is the same as "real*4" statement in nearly all 32-bit computers.
和
real*8"语句将变量名称指定为双精度 8 字节实数,精度为 15 位,幅度范围为 -308 到 +308 的 10.在几乎所有 32 位计算机中,双精度"语句与real*8"语句相同.
The "real*8" statement specifies the variable names to be double precision 8-byte real numbers which has 15 digits of accuracy and a magnitude range of 10 from -308 to +308. The "double precision" statement is the same as "real*8" statement in nearly all 32-bit computers.
这篇关于“real*8"是什么意思?意思是?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!