Is $1e-005 = 1e-5$?

3.1k Views Asked by At

Totally new to Matlab, I encountered the notation $1e-005$ without proper context to guess its meaning. After googling, I found that it may represent the number $0.00001$. However, I know that $1e-5$ already denotes $0.00001$. So is $$ 1e-005 = 1e-5? $$

1

There are 1 best solutions below

4
On BEST ANSWER

Yes; the output of (1e-5) - (1e-005) is 0.

In the same way that (005) - (5) evaluates to 0.

You can omit the brackets if you like.

I don't know if you can force Matlab to always explicit the decimals, as opposed to the more compact scientific notation. But you can try format long, see examples here.

If you insist on decimals, maybe one of those answers will help.

I suppose that the reason for showing the two zeros in the exponent of 1e-005 comes from the fact that the double precision number will never need a four-digit exponent: see here. Therefore, adhering to a three-digit exponent will make a collection of such numbers look nicer / easier to read.

The existence of different possible representations of the same number is presumably a corollary of how numbers are parsed. It seems that there is no publicly available formal grammar for MATLAB, but see here.