Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

NaN  RSS feed

 
John Stark
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Enthuware I encountered some questions about NaNs, like:

Which of the following statements about NaNs are true?

Float.NaN == Float.NaN
Float.NaN == Double.NaN
Float.NaN >= 0
Float.NaN < 0
None of the above

I can't remember reading anything about NaNs in the K & B book. Are NaNs part of the exam?

Thanks,

John
 
Stephan van Hulst
Saloon Keeper
Posts: 7821
142
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure, but NaN comparisons are pretty simply: everything returns false. I believe NaN doesn't even equal itself.
 
John Stark
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you are right Float.NaN == Float.NaN gives false. That makes it pretty easy then, thanks.

John
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!