37

I notice that there is such an expression "1e-5" in Python(probably in other languages also)

  1. What is the name of this notation?

  2. what does it denote in math?

  3. What does 'e' mean? It's the first time I see a character helps to denote some value, are there other characters also help do so?

  4. Why should use this way instead of some other python math operation like pow() etc.

divibisan
  • 11,659
  • 11
  • 40
  • 58
Code Farmer
  • 1,335
  • 3
  • 12
  • 21
  • 8
    Exponential notation: 1 * 10^-5... this has nothing to do with Python specifically, but math in general... – Andrew Li Nov 02 '16 at 21:29
  • 1 × 10−5 is one of the values = "constant" (in c++ is a macro, in C# and Javascript is a const, in others...check) for a value commonly called EPSILON. In C++/python/c# and the languages which support IEEE standard for floating point arithmetic this is the value which separates any two floats/doubles values so adding or removing this value (as written in the question) generates the really next/previous value to the original value, so it acts as the delta which separates two floating point numbers. x....epsilon....y x+epsilon = y y-epsilon = x – Andrea Leganza Jun 20 '21 at 07:21

3 Answers3

40

It is scientific notation. It means 1 × 10−5. In other words, 0.00001.

Nayuki
  • 17,911
  • 6
  • 53
  • 80
  • 1
    Do you have a source for this? because other sources say exponentiation should be done via `**`: https://stackoverflow.com/questions/30148740/how-do-i-do-exponentiation-in-python – information_interchange Jul 17 '19 at 02:03
  • 3
    `e` syntax is for floating-point number **literals**. The `**` operator is for performing a computation on two arbitrary **expressions**. – Nayuki Jul 17 '19 at 16:25
  • @information_interchange here is some documentation https://python-reference.readthedocs.io/en/latest/docs/float/scientific.html – toking May 09 '23 at 08:17
  • Official documentation: https://docs.python.org/3/reference/lexical_analysis.html#floating-point-literals – Nayuki May 10 '23 at 19:50
15

10 ** -5, i.e. 10 to the power of negative 5, 1 divided by 10 to the power of 5, or 0.00001.

Alex Hall
  • 34,833
  • 5
  • 57
  • 89
4

It means 10 to the power of -5 times 1

Francisco
  • 10,918
  • 6
  • 34
  • 45