What is floating point E?

What is E+3 ? What exactly is going on here? Can we use this approach in other data types or use it only in floating points?

 static void Main(string[] args) { double w = 1.7E+3; Console.WriteLine(w); } 

Output: 1700

+11
source share
4 answers

Electronic record

Most calculators and many computer programs present very large and very small results in scientific notation. Since superscripted indexes such as 10 7 may not always be conveniently displayed, the letter E or e is often used to denote a ten-fold exponentiation (which will be written as β€œx 10 b ”) and is accompanied by the exponent value. Please note that with such use, the symbol e is not related to the mathematical constant e or the exponential function e x (confusion, which is less likely with capital E); and although it denotes an exponent, the designation is usually called the (scientific) designation E or (scientific) electronic designation, and not the (scientific) exponential designation (although the latter also occurs). Use of this entry is discouraged by publications.


Regarding your second question:

Can we use this approach in a different data type or can we use it only with a floating point?

See the C # specification :

Real literals [the type of numeric literals that allow the E character in them] are used to write values ​​of types float , double and decimal .

However, if you assign it to anything other than Double , you must appropriately cast or add the suffix suffix, since any literal with e or E in it is recognized as Double in Visual Studio. I can not find where this behavior is indicated.

 float f1 = 7E1; // Compile error. Needs F suffix (7E1F) decimal d1 = 8E2; // Compile error. Needs M suffix (8E2M) double d2 = 9E3; // Works. int overninethousand = (int)9E3 + 1; // Works 
+14
source

All in all, this exponential / scientific notation ...

1.7E + 3 = 1.7 x 10 ^ 3 = 1700

+13
source

E + 3 means decimal place moves 3 times to the right

1.7 β†’ 17.0 β†’ 170.0 β†’ 1700.0

+5
source
 E+3 = 10^3, so 1.7 * 10^3 = 1700 
+1
source

All Articles