17 points signa11 1 day ago 6 comments

j16sdiz 1 hour ago | parent

yes. that's why many number crunching app ships / vendors their own math library

chasil 46 minutes ago | parent

IEEE-754 is a harsh mistress.

https://en.wikipedia.org/wiki/IEEE_754

chasil 38 minutes ago | parent

The VAX floating point was advanced as an alternative standards proposal at that time. Intel won the argument.

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

[delayed]

anitil 39 minutes ago | parent

Even putting aside the ugliness of errno, this is pretty bad. I'm at the point with libc where I try to use as little of it as I can, though I'm not writing a lot of C these days

TZubiri 24 minutes ago | parent

" Dinesh: I said I would do DRM you would do error handling.

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?