JSON e and JSON E
Asked Answered
C

2

15

On the JSON website here, it explains the different possibilities of JSON 'objects'. However, in the numbers section, these appear:

e | e+ | e- | E | E+ | E-

1 - What do these represent?

In searching for an answer, <E> appears alot.

2 - Is <E> related to the above e|Es?

Cactus answered 29/11, 2012 at 2:20 Comment(0)
H
23

It's the notation JSON (and most programming languages) use for scientific notation. Scientific notation is used to denote very large or small floating-point numbers. The e (or equivalently E) is equivalent to "×10^". For example,

3.7e-5 = 3.7E-5 = 3.7×10-5 = 0.000037

Positive or negative exponents may be used, and in the case of positive exponents, the + symbol may be omitted:

6.02e+23 = 6.02e23 = 6.02×1023 = 602 sextillion

More details are available at the Wikipedia article on scientific notation.

Hardheaded answered 29/11, 2012 at 2:25 Comment(0)
S
-5

The letter e looks a lot like the mathematical constant e (the 2.71828 thing) so languages usually let you use E instead. As shown by nandhp, it does the same thing as e.

Spawn answered 23/2, 2015 at 18:7 Comment(2)
The e or E used in scientific notation is not (directly) related to the mathematical constant e.Gilkey
user3128163 was not suggesting that it is related to the constant. They were referring to visually distinguishing it from the constant.Silurian

© 2022 - 2024 — McMap. All rights reserved.