在 g77、Fortran 编译器中设置双精度默认值

发布于 2024-07-12 06:34:53 字数 325 浏览 7 评论 0原文

g77(GNU Fortran 77 编译器)中是否有类似的“-fdefault-real-8”gfortran(GNU Fortran 95 编译器)选项? 此选项将默认实数类型设置为 8 字节宽类型。

我目前的代码中单精度算术限制了我的准确性,因此我需要双精度。 (我想要的不仅仅是双精度的中间值,这是一个 FPU 标志;我希望所有的东西都是双精度的。)我知道我还有一些其他方法(使用 gfortran、使用其他编译器,或者将所有 REAL 更改为 DOUBLE PRECISIONs),但它们对于我的情况并不理想。

那么,有没有办法在g77中将默认实数类型设置为双精度,即8字节宽?

Is there an analog of the "-fdefault-real-8" gfortran (the GNU Fortran 95 compiler) option in g77 (the GNU Fortran 77 compiler)? This option sets the default real type to an 8-byte wide type.

I currently have code where single-precision arithmetic is limiting my accuracy, and so I need double-precision. (It's not just intermediate values that I want to be in double-precision, which is an FPU flag; I want everything to be in double-precision.) I know that I have some other approaches (using gfortran, using other compilers, or changing all REALs to DOUBLE PRECISIONs), but they're not ideal for my situation.

So, is there any way to set the default real type to be double precision, namely 8 bytes wide, in g77?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

云雾 2024-07-19 06:34:53

如果您在手册页中找不到标志,您可以尝试#define 宏。

#define REAL DOUBLE PRECISION

If you can't find a flag in the man pages, you might try a #define macro.

#define REAL DOUBLE PRECISION
初与友歌 2024-07-19 06:34:53

由于许多 FORTRAN 77 仍然合法,是否可以使用 gfortran 编译您的 FORTRAN 77 代码,并提供 -fdefault-real-8 选项?

Since a lot of FORTRAN 77 is still legal, is it possible to use gfortran to compile your FORTRAN 77 code, and supply the -fdefault-real-8 option?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文