57

I have seen in some codes that people define a variable and assign values like 1e-8 or 1e5.

for example

const int MAXN = 1e5 + 123;

What are these numbers? I couldn't find any thing on the web...

codeforester
  • 39,467
  • 16
  • 112
  • 140
Kadaj13
  • 1,423
  • 3
  • 17
  • 41

5 Answers5

91

1e5 is a number expressed using scientific notation, specifically E notation, and it means 1 multiplied by 10 to the 5th power (the 'e' meaning 'exponent').

So 1e5 equals 1*100000 and is equal to 100000. The three notations are interchangeable meaning the same.

wjandrea
  • 28,235
  • 9
  • 60
  • 81
PA.
  • 28,486
  • 9
  • 71
  • 95
  • For more on the scientific notation, see http://en.wikipedia.org/wiki/Scientific_notation – Michael Dec 02 '14 at 22:05
  • Just to note, for Python, `1e5` and `100000` are slightly different in that one's a `float` and one's an `int`. But they are equal. – wjandrea Feb 25 '23 at 17:23
31

1e5 means 1 × 105.

Similarly, 12.34e-9 means 12.34 × 10−9.

Generally, AeB means A × 10B.

wjandrea
  • 28,235
  • 9
  • 60
  • 81
Yashwant Kumar
  • 407
  • 4
  • 5
  • 3
    This! I think people who say 1e5 is equal to 10 to the 5th power are giving an incomplete answer. So I like your answer: `1x10^5`. Thanks – Erik van de Ven Dec 19 '20 at 15:39
3

this is scientific notation for 10^5 = 100000

DaveG
  • 741
  • 6
  • 16
0

1e5 is 100000. 5 stand for the amount of zeros you add in behind that number. For example, lets say I have 1e7. I would put 7 zeros behind 1 so it will become 10,000,000. But lets say that the number is 1.234e6. You would still add 6 zeros at the end of the number so it's 1.234000000, but since there is that decimal, you would have to move it to the right 6 times since it's e6.

0

The values like: 1e-8 or 1e5

means;

1e-8 = 1 * 10^(-8)

And

1e5 = 1 * 10

Ashok Chhetri
  • 428
  • 6
  • 10