【发布时间】:2021-06-19 06:46:20
【问题描述】:
根据 Octave 的 format 文档,short 的默认值为:
By default, Octave displays 5 significant digits in a human
readable form (option ‘short’ paired with ‘loose’ format for
matrices). If format is invoked without any options, this default
format is restored.
short
Fixed point format with 5 significant figures in a field that
is a maximum of 10 characters wide. (default).
If Octave is unable to format a matrix so that columns line up
on the decimal point and all numbers fit within the maximum
field width then it switches to an exponential ‘e’ format.
short e long e
Exponential format. The number to be represented is split
between a mantissa and an exponent (power of 10). The mantissa
has 5 significant digits in the short format and 15 digits in
the long format. For example, with the ‘short e’ format, pi is
displayed as 3.1416e+00.
这是我得到的:
octave:8> pi*1e3
ans = 3141.6
octave:9> pi*1e4
ans = 31415.92654
我可以看到short 如何产生第一个输出,但看不到第二个输出精度是如何达到的。谁能解释一下?
采取的步骤
我认为除了 ~/.octaverc 中的 1 条语句之外,我已经处于默认条件:format compact。我只通过octave --no-window-system --silent 在 CLI 模式下使用 Octave。 [a b c]=format 和 ver 的结果是:
octave:1> [a b c] = format
a = short
b = compact
error: element number 3 undefined in return list
octave:1> ver
----------------------------------------------------------------------
GNU Octave Version: 5.2.0 (hg id: eb46a9f47164)
GNU Octave License: GNU General Public License
Operating System: CYGWIN_NT-10.0-19041 3.1.7-340.x86_64 2020-08-22 17:48 UTC x86_64
5.2 版是 Cygwin 的最新版本。
我使用 GUI (octave --gui) 得到了相同的结果,无论是在波动精度方面,还是在 format 和 ver 的输出方面。
【问题讨论】:
标签: octave