src/test/utility/strtof.c
static const char *_try_strtof(const char *str, float expect, int consume,
                               int erange)
{
    static char error_buf[1000];

    if (consume < 0) {
        consume = strlen(str);
    }

    char *end;
    errno = 0;
    float retval = strtof(str, &end);
    const int consumed = end - str;
    const int got_erange = (errno == ERANGE);

    if (retval != expect) {
        volatile float x;
        x = retval;
        const unsigned long retval_bits = FLOAT_BITS(x);
        x = expect;
        const unsigned long expect_bits = FLOAT_BITS(x);
        strformat(error_buf, sizeof(error_buf),
                  "strtof(\"%s\") returned %.8g (0x%08lX), expected %.8g"
                  " (0x%08lX)", str, retval, retval_bits, expect, expect_bits);
        return error_buf;
    }
    if (consumed != consume) {
        strformat(error_buf, sizeof(error_buf),
                  "strtof(\"%s\") consumed %d bytes, expected %d",
                  str, consumed, consume);
        return error_buf;
    }
    if ((erange != 0) != got_erange) {
        strformat(error_buf, sizeof(error_buf),
                  "strtof(\"%s\") %s ERANGE, but %s",
                  str, got_erange ? "generated" : "did not generate",
                  erange ? "should have" : "should not have");
        return error_buf;
    }
    return NULL;
}
/**
 * _try_strtof:  Helper function for the TRY_STRTOF() macro, used to reduce
 * code size.  Returns NULL if the test passes, otherwise an error message.
 */
Helper function for the TRY_STRTOF() macro, used to reduce
code size.  Returns NULL if the test passes, otherwise an error message.
Helper function for the TRY_STRTOF () macro used to reduce code size . Returns NULL if the test passes otherwise an error message .
static const char *_try_strtof(const char *str, float expect, int consume,
                               int erange)
{
    static char error_buf[1000];
    if (consume < 0) {
        consume = strlen(str);
    }
    char *end;
    errno = 0;
    float retval = strtof(str, &end);
    const int consumed = end - str;
    const int got_erange = (errno == ERANGE);
    if (retval != expect) {
        volatile float x;
        x = retval;
        const unsigned long retval_bits = FLOAT_BITS(x);
        x = expect;
        const unsigned long expect_bits = FLOAT_BITS(x);
        strformat(error_buf, sizeof(error_buf),
                  "strtof(\"%s\") returned %.8g (0x%08lX), expected %.8g"
                  " (0x%08lX)", str, retval, retval_bits, expect, expect_bits);
        return error_buf;
    }
    if (consumed != consume) {
        strformat(error_buf, sizeof(error_buf),
                  "strtof(\"%s\") consumed %d bytes, expected %d",
                  str, consumed, consume);
        return error_buf;
    }
    if ((erange != 0) != got_erange) {
        strformat(error_buf, sizeof(error_buf),
                  "strtof(\"%s\") %s ERANGE, but %s",
                  str, got_erange ? "generated" : "did not generate",
                  erange ? "should have" : "should not have");
        return error_buf;
    }
    return NULL;
}
static const char * _try_strtof ( const char * str , float expect , int consume , int erange ) { static char error_buf [ 1000 ] ; if ( consume < 0 ) { consume = strlen ( str ) ; } char * end ; errno = 0 ; float retval = strtof ( str , & end ) ; const int consumed = end - str ; const int got_erange = ( errno == ERANGE ) ; if ( retval != expect ) { volatile float x ; x = retval ; const unsigned long retval_bits = FLOAT_BITS ( x ) ; x = expect ; const unsigned long expect_bits = FLOAT_BITS ( x ) ; strformat ( error_buf , sizeof ( error_buf ) , " \" \" " " " , str , retval , retval_bits , expect , expect_bits ) ; return error_buf ; } if ( consumed != consume ) { strformat ( error_buf , sizeof ( error_buf ) , " \" \" " , str , consumed , consume ) ; return error_buf ; } if ( ( erange != 0 ) != got_erange ) { strformat ( error_buf , sizeof ( error_buf ) , " \" \" " , str , got_erange ? " " : " " , erange ? " " : " " ) ; return error_buf ; } return NULL ; }
_try_strtof:  Helper function for the TRY_STRTOF() macro, used to reduce
 code size.
_try_strtof : Helper function for the TRY_STRTOF () macro used to reduce code size .