How to check whether a number is a "NaN" in Java / Android?

android, eclipse, java, nan

Solution

in your case should be enough:

   if (Double.isNaN(averageState))

take a look here

Problem

Please have a look at the following code ``` private List createTheDynamicWordList(String algorithm, double averageStat) { Toast.makeText(context, ""+averageStat, Toast.LENGTH_LONG).show(); } ``` in some cases, I get the `averageStat` as a 'NaN' value. I need to check whether the number if 'NaN' or not. How can I do this? Using `NumberFormatException` here didn't work.

Original source

Related problems