Fortran写入语句:这是什么“9999”在做什么? [英] Fortran write statement: what is this "9999" doing?

查看:153
本文介绍了Fortran写入语句:这是什么“9999”在做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法弄清楚这个9999在e20.8的前面,在这个Fortran写作声明的标签中是什么。



是否不涉及代码中的任何其他行。换句话说,在程序的其他地方没有标注9999的行。

  write(11, '(9999e20.8)')(9999.0,i = 1,2 *(numant + numunique))

我很混乱 - 我还没有找到谷歌网络搜索的答案,但我想我得到关于写入语句语法和格式的一般图片。



是这个足够的信息提供了意义吗?

解决方案

这是一个重复计数;格式代码的一般格式是(计数)(类型)(格式),例如,如这里的教程。与基于C的语言不同,未使用的格式代码简单地被忽略,所以该行基本上说以科学格式写出尽可能多的实数(小数点后面有8位数字)如下面的输出列表中所示。 (如果你不喜欢这样做,用一个硬编码足够大的数字,你必须以编程方式生成格式字符串以获得正确的重复代码。



输出列表是一个隐含做循环,它产生数字9999.0 2 *(numant + numuniqe)次。


I can't figure out what in the world this "9999" is doing in front of the e20.8, in the label of this fortran write statement.

Is does not refer to any other line in the code. In other words, there isn't a line labeled 9999 to which it refers, elsewhere in the program.

write(11,'(9999e20.8)') (9999.0, i=1,2*(numant+numunique))

I'm boggled - I haven't found the answer from google web searches, although I think I get the general picture about write statement syntax and formatting.

Is this enough info provided to make sense?

解决方案

It's a repetition count; the general format for a format code is (count)(type)(format), eg as described in this tutorial here.

Unlike C-based languages, unused formatting codes are simply ignored, so this line essentially says "write out as many real numbers in scientific format (with 8 digits after the decimal) as there are in the following output list". (If you don't like doing it this way, with a hardcoded "big enough" number, you'd have to programatically generate the format string to have the "right" repetition code.

The output list is an implied-do loop, which generates the number 9999.0 2*(numant+numuniqe) times.

这篇关于Fortran写入语句:这是什么“9999”在做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆