简体   繁体   English

fortran中“ double”类型的大小是多少?

[英]What is the size of a type “double” in fortran?

I'm trying to study chaos theory (Butterfly effect? - smallest initial condition can have adverse effects on the outcome). 我正在尝试研究混沌理论(蝴蝶效应?-最小的初始条件可能会对结果产生不利影响)。 I book I'm following has code in Fortran, I've been assigned by my professor to try and implement the program in C++, however I can't seem to replicate the results, and so I was wondering: 我预订的书中有Fortran中的代码,我的教授已指派我尝试用C ++实现程序,但是我似乎无法复制结果,所以我想知道:

What is the size of a type double in Fortran? Fortran中的double类型的大小是多少?

Thanks 谢谢

If by "type double" you mean what used to go by the name of "double precision", then - it depends. 如果用“双精度类型”来指代“双精度”的名称,那么-取决于。 It was commonly double of what single represented, but that also varied with your environment (the implementation of the processor). 它通常是单个表示的两倍,但也随您的环境(处理器的实现)而变化。

Nowadays, (>F90 I think) those problems are usually avoided by explicitly stating a custom data type, by stating your requirements in regards of precision and data range. 如今,(我认为> F90)通常可以通过明确声明自定义数据类型,说明您对精度和数据范围的要求来避免这些问题。 Check out functions SELECTED_REAL_KIND (and the links in the help from this one onward). 请查看SELECTED_REAL_KIND函数(以及此后的帮助中的链接)。
In short, you define a kind type, for a given range/precision. 简而言之,您可以为给定的范围/精度定义一种类型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM