Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Fortran:将硬编码值传递给接受实数(16)的函数并不';不行。我怎样才能解决这个问题?_Fortran_Gfortran_Fortran90 - Fatal编程技术网

Fortran:将硬编码值传递给接受实数(16)的函数并不';不行。我怎样才能解决这个问题?

Fortran:将硬编码值传递给接受实数(16)的函数并不';不行。我怎样才能解决这个问题?,fortran,gfortran,fortran90,Fortran,Gfortran,Fortran90,相关代码: Parts(3, indexcount) = push(pi/2, 0.0d0,0.0d0,0.0d0, Parts(1, indexcount),Parts(2, indexcount), 0.01d0, 20000.0d0) real(16) function push(phaseinit, yinit, pxinit, pyinit, a0, R, dt, Time_total) implicit none real(16) :: phaseinit, yinit, pxi

相关代码:

Parts(3, indexcount) = push(pi/2, 0.0d0,0.0d0,0.0d0, Parts(1, indexcount),Parts(2, indexcount), 0.01d0, 20000.0d0)

 real(16) function push(phaseinit, yinit, pxinit, pyinit, a0, R, dt, Time_total)
implicit none
real(16) :: phaseinit, yinit, pxinit, pyinit, gammamax, I0, R_star, k_ratio, Vph

etc...
在编译时:

Error: Type mismatch in argument 'yinit' at (1); passed REAL(8) to REAL(16)

我试图找到在线资源,详细说明如何正确初始化
real(16)
的数值,但什么也找不到。这似乎允许我初始化
real(8)
,但我不知道
real(16)

的相应过程是什么,也就是说,
0。_16
是一个16类的实数常量。其他的问题、答案和评论将说明一个事实,即你应该谨慎地假设16。几乎所有与Fortran相关的源代码都会解决这个问题。您可以在线搜索fortran literal种类参数。我倾向于使用真实的内在参数,尽管这并不适用于所有值。real(0,16)、real(20000.0d0,16)和real(1,16)/100都能工作,但real(0.01d0,16)不能。对我来说,它提供了一些所需的文档。