#getting an NaN output
18 messages · Page 1 of 1 (latest)
are you dividing 0.0/0.0?
Here is your java(15.0.2) output @violet bay
NaN
i see
so if theres one instance of that it just overrides the rest of the equations needed in the output?
Yeah, NaN is a bit viral
But you can check for it with Double.isNaN(...)
./run ```java
System.out.println(Double.isNaN(1.0/0.0));
System.out.println(Double.isNaN(0.0/0.0));
Here is your java(15.0.2) output @violet bay
false
true
./run ```java
double x = 0.0/0.0;
double y = x + 45.0;
double z = y * 3.0;
System.out.println(z);
Here is your java(15.0.2) output @violet bay
NaN
./run ```java
double x = 0.0/0.0;
if (x == x) {
System.out.println("Equal");
}
else {
System.out.println("Not equal");
}