Hello,

Can someone explain the exponential notation to me? For example, how does `13.5e9`

become `13500000000`

?

Thank you.

Hello,

Can someone explain the exponential notation to me? For example, how does `13.5e9`

become `13500000000`

?

Thank you.

Note that in Rust, the scientific notation can only describe floats, not integers, so 13.5e9 isn't `13500000000`

but `13500000000.0`

(Playground).

The scientific notation is short for "times 10 to the power of…".

Thus `13.5e9`

means "`13.5`

times 10 to the power of 9". Ten to the power of nine is 1,000,000,000. And 13.5 times 1,000,000,000 is 13,500,000,000.

Also see Wikipedia on scientific notation.

1 Like

You can also refer to the Rust compiler's source code, which shows how it parses this exponential notation.

1 Like

Hello,

Thank you so much for your reply.

Can you explain `12e-6`

too?

Yes, 10 to the power of −6 is 0.000001.

Basically:

10 to the power of −2 = 0.01

10 to the power of −1 = 0.1

any number to the power of 0 = 1

10 to the power of 1 = 10

10 to the power of 2 = 100

10 to the power of 3 = 1000

and so on.

A good rule to memorize the outcome of scientific notation is to assume that the decimal separator is moved.

For example:

`12e-6`

is the same as:

`1.2e-5`

`0.12e-4`

`0.012e-3`

`0.0012e-2`

`0.00012e-1`

`0.000012e-0`

`0.000012e0`

`0.000012`

Usually, you can read `…e-6`

as Mikro prefix in the metric system. For example 12 µm are equal to `12e-6`

meter. Or 12 millimeter are equal to `12e-3`

meter.

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.