
There are always subtle nuances to every computer language. Recently, I found the following NaN (not a number) nuance in Java:
Bad:
if (value == Double.NaN) // Do something...
Good:
if (Double.isNaN(value)) // Do something....

There are always subtle nuances to every computer language. Recently, I found the following NaN (not a number) nuance in Java:
Bad:
if (value == Double.NaN) // Do something...
Good:
if (Double.isNaN(value)) // Do something....
Thanks. The comparison seems like it should work, but oh well. All languages has oddities.