5 comments

  • anitil 4 minutes ago

    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

  • chasil 11 minutes ago

    IEEE-754 is a harsh mistress.

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

  • CamperBob2 8 minutes ago

         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.

  • j16sdiz 33 minutes ago

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