posted 11 years ago
Yes, just because  or as we computer sciency type fellas like to say, "by definition." The Java Lanaguage Specificiation explicitly states that NaN is not equal to anything, including itself.
sven studde
Ranch Hand
Posts: 148
leo donahue
Ranch Hand
Posts: 327
posted 11 years ago
If we compare with the inequality operator: != The comparison is true.
"By definition" is the only option.
If floating point division by zero is really not the same as whatever the value of java.lang.Double.NaN is, then what is the value of floating point division by zero? Did someone just choose to use the same "word"(NaN) to describe that value?
Originally posted by Ernest FriedmanHill:
Yes, just because  or as we computer sciency type fellas like to say, "by definition." The Java Lanaguage Specificiation explicitly states that NaN is not equal to anything, including itself.
If we compare with the inequality operator: != The comparison is true.
"By definition" is the only option.
If floating point division by zero is really not the same as whatever the value of java.lang.Double.NaN is, then what is the value of floating point division by zero? Did someone just choose to use the same "word"(NaN) to describe that value?
Thanks, leo
Keith Lynn
Ranch Hand
Posts: 2410
posted 11 years ago
It depends on what the numerator is.
If the numerator and denominator are both 0, the result is NaN.
If the numerator is, for instance, 1.0, then 1.0/0 is Infinity.
As Tim pointed out, in the case of 0.0/0 != Double.NaN, just because two things are not numbers, they are not necessarily equal to each other.
[ October 16, 2006: Message edited by: Keith Lynn ]
Originally posted by leo donahue:
If we compare with the inequality operator: != The comparison is true.
"By definition" is the only option.
If floating point division by zero is really not the same as whatever the value of java.lang.Double.NaN is, then what is the value of floating point division by zero? Did someone just choose to use the same "word"(NaN) to describe that value?
It depends on what the numerator is.
If the numerator and denominator are both 0, the result is NaN.
If the numerator is, for instance, 1.0, then 1.0/0 is Infinity.
As Tim pointed out, in the case of 0.0/0 != Double.NaN, just because two things are not numbers, they are not necessarily equal to each other.
[ October 16, 2006: Message edited by: Keith Lynn ]
leo donahue
Ranch Hand
Posts: 327
posted 11 years ago
Mathematically speaking, x/0 is undefined, not infinity. Where x is a real number, not zero. Infinity is not a number, but can basically be described as if there exists a onetoone correspondence between that set and a proper subset of itself then the set is infinite.
If you have 1/x, then its value approaches infinity as x goes to zero, but 1/0 is not an infinite number, since infinity is not a number.
0/0 is indeterminant.
If you have 1/x, then its value approaches infinity as x goes to zero, but 1/0 is not an infinite number, since infinity is not a number.
0/0 is indeterminant.
The moustache of a titan! The ad of a flea:
The WEB SERVICES and JAXRS Course
https://coderanch.com/t/690789/WEBSERVICESJAXRS
