Comment Comment by CamperBob2 if (sscanf(string,"%lf",&foo) != 1) { bad_float(); } This has the benefit of handling scientific notation, too, which some of the other CRTL functions inexplicably do not.For extra reassurance, initialize foo to NaN or DBL_MAX or something, and verify that it is no longer equal to that value. parent CamperBob2 21 days ago
For extra reassurance, initialize foo to NaN or DBL_MAX or something, and verify that it is no longer equal to that value.