What does the symbol “E” or “e” mean at large fractional and float outputs?

Studying java, I had unexpected output for the following code:

int i = 1234567890;
float f = i;
int result = i - (int)f;

It returned as a value for the variable "result" value -46, and I expected 0.0, assuming that "float f = i" will be converted to 1234567890.0 instead of 1.23456794E9. Trying to figure this out, I noticed that a float is allowed at most 7 digits before the base number, and if a float with more than 7 digits to the base point is allowed, the compilers output a line that is composed with the number base in second place in the index of this rows and, in the penultimate place of the index, returns its "E" or "e". What is it? What does e mean?

+4
source share
1 answer

This is scientific notation in E. notation Estands for exponent.

1.23456794E9means 1.23456794 × 10 9 which coincides with 1234567940.

Limited type accuracy floatmeans that the value is not the same value as int. Scientific notation is used to display large or small values; it has nothing to do with the loss of accuracy.

+6
source

All Articles