format long 和 format long g 的区别

Differences between format long and format long g

我在 Matlab.But 中搜索了 format long 和 format long g 之间的差异 我不确定它们之间的确切差异 them.Does 它们之间的差异会影响准确性吗?

谢谢...

Matlab中的命令format X影响文本的显示

所以format short会显示小数点后4位。这是默认显示选项。命令 format long 将显示小数点后更多的数字。添加 G 将告诉 Matlab 如果它更紧凑,则额外以科学计数法显示。

无论是计算值还是精度,都没有区别,只是显示而已。来自 doc format 或此处 Display Format Matlab article:

format does not affect how MATLAB computations are done. Computations on float variables, namely single or double, are done in appropriate floating point precision, no matter how those variables are displayed. Computations on integer variables are done natively in integer.