How Can I use NaN and infinity in Java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How Can I use NaN and infinity in Java

http://ideone.com/NXG2b2 code link. help me to solve this. how can I use NaN and infinity in if else to print something for NaN and infinity value

5th Jun 2017, 12:04 AM
Sadiqul Sakif
Sadiqul Sakif - avatar
5 Answers
+ 2
Did you fix it? I don't see an error. Which line?
5th Jun 2017, 12:45 AM
Rrestoring faith
Rrestoring faith - avatar
+ 1
Nan isn't defined, you have to grab it from the double class. Like so: if(R1 != Double.NaN || R1 != Double.NEGATIVE_INFINITY)
5th Jun 2017, 12:14 AM
Rrestoring faith
Rrestoring faith - avatar
0
Thanks
5th Jun 2017, 12:31 AM
Sadiqul Sakif
Sadiqul Sakif - avatar
0
would you help me again? I got stuck with boolean oparator. would you this out? and what to do now? >> http://ideone.com/NXG2b2
5th Jun 2017, 12:40 AM
Sadiqul Sakif
Sadiqul Sakif - avatar
0
It Showed bad operand. I solve this but now stuck with results. I will seek your help I can't fix it.
5th Jun 2017, 12:51 AM
Sadiqul Sakif
Sadiqul Sakif - avatar