• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

NaN

 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 15741
368
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you are right Float.NaN == Float.NaN gives false. That makes it pretty easy then, thanks.

John
reply
    Bookmark Topic Watch Topic
  • New Topic