convert the input to a float, or NAN if the input is not a float
double toFloat(String str) { try { return double.parse(str); } on FormatException { return double.nan; } }