“double”类型的大小是多少?在 Fortran 中?
我正在尝试研究混沌理论(蝴蝶效应? - 最小的初始条件会对结果产生不利影响)。我所关注的书有 Fortran 代码,我的教授指派我尝试用 C++ 实现该程序,但是我似乎无法复制结果,所以我想知道
: 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:
What is the size of a type double in Fortran?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果“双精度类型”指的是过去所谓的“双精度”名称,那么 - 这取决于。它通常是单个代表的两倍,但这也随着您的环境(处理器的实现)而变化。
如今,(我认为>F90)这些问题通常可以通过明确声明自定义数据类型、声明您在精度和数据范围方面的要求来避免。查看函数 SELECTED_REAL_KIND(以及此之后帮助中的链接)。
简而言之,您为给定的范围/精度定义了一种类型。
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. Check out functions SELECTED_REAL_KIND (and the links in the help from this one onward).
In short, you define a kind type, for a given range/precision.