int s = 1e9;
What is type of 1e9
and how precise is it? (Is it exactly equal to 1000000000?)
Printing type of a value/variable to stdout
would be useful if it's possible.
Scientific Notation Rules The exponent must be a non-zero integer, that means it can be either positive or negative. The absolute value of the coefficient is greater than or equal to 1 but it should be less than 10. Coefficients can be positive or negative numbers including whole and decimal numbers.
Updated: 11/16/2019 by Computer Hope. A method of writing a very large or small numbers, scientific notation is an integer between 1 and 10 multiplied by the power of 10. For example, "987,000,000" could be written in scientific notation as 9.87 * 108, 9.87 * 10^8, or 9.87e+8.
Scientific notation is used by scientists, mathematicians, and engineers when they are working with very large or very small numbers. Using exponential notation, large and small numbers can be written in a way that is easier to read.
1e9
is a double
that has an exact representation in the IEEE floating point representation. The C++ standard doesn't mandate IEEE floating point.
s
is an int
, so the double
value will be automatically converted to an int
. How this takes place is to some extent up to the implementation. On most machines nowadays, this conversion means s
will be given an initial value of 1000000000.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With