17 points signa11 1 day ago 6 comments
j16sdiz 1 hour ago | parent
chasil 46 minutes ago | parent
chasil 38 minutes ago | parent
https://sixlettervariable.blogspot.com/2007/05/vax-floating-...
CamperBob2 43 minutes ago | parent
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.
shakna 3 minutes ago | parent
anitil 39 minutes ago | parent
TZubiri 24 minutes ago | parent
Gilfoyle: Anything to do with errors is more your vibe"
https://www.youtube.com/watch?v=oyVksFviJVE&t=49
Oh, this one is easy.
Just don't make the errors, then you don't have to detect them.
When your app stops issuing these errors, then you won't have to write blog posts complaining that someone elses code can't handle your errors.
Definitely you should never be converting strings to floats ever anyways, see how I'm going on a limb here without any knowledge of your application, but then you know that I'm right because there's no reason why you would ever do that?