Fortran实际文字表达式中的后缀'd + 0' [英] postfix 'd+0' in Fortran real literal expressions
问题描述
有没有人知道后缀 d + 0 在下面的M1,M2和M4的分配中意味着什么,或者网络上有没有任何资源可以找到这个信息?
pre $子程序图(t,x,p,q,nga ,nt,wron,
& ngq,gq,ngaq1,ngaq2,gaq,rwh,iwh)
隐式无
整数* 4 nga,nt,ngq,ngaq1, (*)
real * 8 t,x(*),p(*),q(*),wron(nga,*),
& gq(ngq,*),gaq(ngaq1,ngaq2,*),rwh(*)
real * 8 M1,M2,M3,M4,mr,mst,h3,Tc
整数* 8 iflag
c DISCRETIZE1(Tc,rwh,iwh)
M1 = 0.1362d + 0
M2 = 0.09806d + 0
M3 = M1 + M2
M4 = 0.236d + 0
mr = M1 * x(1)+ M2 * x(2)+ M3 * x(3)+ M4 * x(4)
mst = M1 * q(1)+ M2 * q(2)+ M4 * q(3)
call mess3(t,x,h3,p,q,rwh,iwh ,iflag)
写(10,100)t,x(1),x(2),x(3),x(4),Tc,h3,mr-mst
100格式(e20.10,7(1x,e20.10))
end
以下是我可以找到的第一个参考资料的一段引文:
储存在电脑中的号码是
limi规模和精度。
限制取决于特定的
计算机。因此,一个真实的数字只有
一定数量的重要
数字。如果计算需要更多有效数字
,则必须使用
DOUBLE PRECISION数字。
DOUBLE PRECISION常量写成
,其形式与
单精度REAL常数相同,除了
用D代替E,
是尾数指数。
这里是一个更好的参考, www.fortran.com ,特别是F77标准。
< blockquote>
4.5.2双精度常量
$ b 双精度
常量的形式为:
$ b
- 基本实常数
后跟双精度
指数
- 整型常量后跟
双精度指数
双精度常量的
是常数的
乘积在
之前,D和10的幂表示
,由D之后的整数
表示(2)的整数常量部分可能
被写入的数字多于
处理器将用来估计该常量的
值。
Does anyone knwow what the postfix "d+0" means in the assignments to M1, M2 and M4 below or is there any resource on the web or a book where one is very likely to find this information?
subroutine plot( t, x, p, q, nga, nt, wron, & ngq, gq, ngaq1, ngaq2, gaq, rwh, iwh ) implicit none integer*4 nga, nt, ngq, ngaq1, ngaq2, iwh(*) real*8 t, x(*), p(*), q(*), wron(nga,*), & gq(ngq,*), gaq(ngaq1,ngaq2,*), rwh(*) real*8 M1, M2, M3, M4, mr, mst, h3, Tc integer*8 iflag c DISCRETIZE1( Tc, rwh, iwh ) M1 = 0.1362d+0 M2 = 0.09806d+0 M3 = M1 + M2 M4 = 0.236d+0 mr = M1*x(1) + M2*x(2) + M3*x(3) + M4*x(4) mst = M1*q(1) + M2*q(2) + M4*q(3) call mess3( t, x, h3, p, q, rwh, iwh, iflag ) write (10,100) t, x(1), x(2), x(3), x(4), Tc, h3, mr-mst 100 format( e20.10, 7(1x,e20.10) ) end
解决方案It means "double precision" and the +0 means 10 to the zeroth power (zero is the exponent).
Here's a quote from first reference I could find:
A number stored in a computer is limited in magnitude and precision. The limits depend on the particular computer. Thus, a REAL number has only a certain number of significant digits. If more significant digits are required for a calculation, then DOUBLE PRECISION numbers must be used. A DOUBLE PRECISION constant is written in the same exponential form as a single precision REAL constant except with a D instead of an E separating the mantissa from the exponent.
And here is a quote from a better reference, www.fortran.com, specifically the F77 standard.
4.5.2 Double Precision Constant.
The forms of a double precision constant are:
- Basic real constant followed by a double precision exponent
- Integer constant followed by a double precision exponent
The value of a double precision constant is the product of the constant that precedes the D and the power of ten indicated by the integer following the D. The integer constant part of form (2) may be written with more digits than a processor will use to approximate the value of the constant.
这篇关于Fortran实际文字表达式中的后缀'd + 0'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!