In the given link: Reading scientific notation D+ it is stated that D and E (or e) are similar. However, when I run the following code in C++:
long double x;
cin >> x;
printf("%.30Lf",x);
and give input 123D+01
, the output is 123.000000000000000000000000000000
and when I give the input 123D-01
, the output is still 123.000000000000000000000000000000
. However, for the input is 123E+01
, the output is 1230.000000000000000000000000000000
and for input 123E-01
, the output is 12.300000000000000000173472347598
.
In octave, >> str2num("123D+01")
gives the output ans = 1230
while for >> str2num("123D-01")
, the output is ans = 12.300
.
Please explain!