First read Float, Double, and Decimal. What is the correct way to use them? .
Ali says that it is not possible to represent all numbers in binary format. Then some numbers are taken by approximation. Note that there are 308 digits in this number and it is -1.79769313486232E + 308.
Because this type of data is inaccurate when you have a number with an extreme, very low or very high value, adding 1 does not actually change the value, in such a large amount the binary representation can not differentiate a number on the other, the bits of both are the same.
Well, does
long
have the same size as a
double
, as the latter can represent many more integers and an absurd number of fractional numbers with the same amount of bits as an integer? Simple, it does not represent all these numbers, only approximations of them, so very close numbers actually have the same binary representation, there is not even a 1-bit difference between them, so you can get enough magnitude for very large numbers, but you can not exact number, it's as if he's just sampling.
This is why I always say that if accuracy is important, do not use a binary encoded floating-point number.