Henry Wong wrote:Java doubles follow the IEEE specification. The IEEE specification for floating point defines special values for Infinity, Negative infinity, Negative zero, and NaN (not a number). These are actually defined numbers, along with operations that generate them.
Java integers follow the twos complement format. There are no special definitions for any of the above values. In this case, there is no representation of a NaN for an integer.
Henry
samir vasani wrote:The above answers are not satisfactory,so please give the correct reason
Lester Burnham wrote:
samir vasani wrote:The above answers are not satisfactory,so please give the correct reason
Are you saying that you don't understand the answers, or that you think they are incorrect? If the former, what *do* you understand about them? If the latter, *why* do you think they're incorrect? (And please don't post in all-bold; it's annoying to read, and does nothing to make people want to answer.)
samir vasani wrote:
Lester Burnham wrote:
samir vasani wrote:The above answers are not satisfactory,so please give the correct reason
Are you saying that you don't understand the answers, or that you think they are incorrect? If the former, what *do* you understand about them? If the latter, *why* do you think they're incorrect? (And please don't post in all-bold; it's annoying to read, and does nothing to make people want to answer.)
Eleborate answers properly
Stephan van Hulst wrote:The simple answer is that the way the developers designed integers, there is no room for values such as NaN.
Here's an example: ints can holds values -2.147.483.648 to 2.147.483.647. Then all the possible combinations of bits are exhausted. There is no way to fit a value like NaN in there. The designers could have chosen to make the value -2.147.483.648 mean the same as NaN, but they chose not to, because it makes integer values unnecessarily complex (consider what values they would have to use to define NaN in short, byte and long as well, and how these values have to be converted when casting to another type).
Simply put, it's too complex and it's barely useful.
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |