Thread: Fun Fact
View Single Post
  #9   Spotlight this post!  
Unread 25-02-2013, 22:14
sur sur is offline
Registered User
AKA: Sujit Rao
FRC #3324 (Metrobots)
Team Role: Alumni
 
Join Date: May 2012
Rookie Year: 2011
Location: Ohio
Posts: 12
sur is an unknown quantity at this point
Re: Fun Fact

Quote:
Originally Posted by Greg McKaskle View Post
Equally fun fact:
When you compare anything and one of the elements is NaN, the result is false. Nan > 0 is false and Nan < 0 is false and Nan == 0 is false.

And it isn't just LV. This is what IEEE 754 says to do. And it makes sense, but at the same time will surprise you at times when you least expect it -- possibly causing shooters to misbehave, wormholes to form, etc.
Apparently this is how IsNaN is implemented in C#: http://stackoverflow.com/a/1145462.
Reply With Quote