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