1d3 = 1e3 = 1000? in matlab

8 ビュー (過去 30 日間)
JiHun Jung
JiHun Jung 2014 年 2 月 14 日
コメント済み: Jan 2021 年 2 月 24 日
Hi everyone!
I want know what's difference between 'd' and 'e' in matlab.
Sincerely, JH Jung

採用された回答

Walter Roberson
Walter Roberson 2014 年 2 月 14 日
Historical support. I don't think the "d" form is even documented now. The "D" form was common in FORTRAN in the 1960's.
  1 件のコメント
JiHun Jung
JiHun Jung 2014 年 2 月 17 日
Walter Roberson, Thank for your answer!

サインインしてコメントする。

その他の回答 (1 件)

Jan
Jan 2014 年 2 月 14 日
編集済み: Jan 2021 年 2 月 24 日
Last year the technical support answered, that the following number formats are working, but not documented:
2.
.2
.2e3
.2e+03
-.2E3
2d3
.2e2.*2.
2..*.2
  5 件のコメント
Walter Roberson
Walter Roberson 2021 年 2 月 23 日
FORTRAN E format was (originally) single precision for constants and D format was double precision. For example
COMMON/ABC/3.2e-1,3.2d-1/
initialized a single precision followed by a double precision
Jan
Jan 2021 年 2 月 24 日
@Yukteshwar Baranwal: As I have written in my answer, I've asked the support, because I did not find an explanation in the documentation, if the mentiones notations are accepted.
Tme MathWorks answered, that only the formats are guaranteed to work, which are created as output of sprintf(). Therefore I do not use leading or trailing dots in numerical constants and stay at "e" or "E" for the exponent.
Nevertheless, fscanf accepts these notations and M-code is interpreted correctly also. But I stay at the documented syntax, because this is no drawback.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by