This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCHv3 01/11] Begin refactor of libm-test.inc
- From: "Paul E. Murphy" <murphyp at linux dot vnet dot ibm dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Fri, 27 May 2016 10:09:07 -0500
- Subject: Re: [PATCHv3 01/11] Begin refactor of libm-test.inc
- Authentication-results: sourceware.org; auth=none
- References: <cover dot 1464297421 dot git dot murphyp at linux dot vnet dot ibm dot com> <c48cd38f893b8f563319b1270b7cfbc710ab93c1 dot 1464297421 dot git dot murphyp at linux dot vnet dot ibm dot com> <alpine dot DEB dot 2 dot 20 dot 1605262242010 dot 6600 at digraph dot polyomino dot org dot uk>
On 05/26/2016 05:45 PM, Joseph Myers wrote:
> On Thu, 26 May 2016, Paul E. Murphy wrote:
>
>> +/* Maximum character buffer to store a stringitized FLOAT value. */
>> +# define FSTR_MAX (128)
>
> No space after '#', as this isn't inside a preprocessor conditional.
>
> OK with that change, *but* please note:
Fixed.
>
>> @@ -428,8 +432,12 @@ print_float (FLOAT f)
>> else if (isnan (f))
>> printf ("qNaN\n");
>> else
>> - printf ("% .*" PRINTF_EXPR " % .*" PRINTF_XEXPR "\n",
>> - TYPE_DECIMAL_DIG - 1, f, TYPE_HEX_DIG - 1, f);
>> + {
>> + char fstrn[FSTR_MAX], fstrx[FSTR_MAX];
>> + FTOSTR (fstrn, FSTR_MAX, "% .*" PRINTF_EXPR, TYPE_DECIMAL_DIG - 1, f);
>> + FTOSTR (fstrx, FSTR_MAX, "% .*" PRINTF_XEXPR, TYPE_HEX_DIG - 1, f);
>> + printf ("%s %s\n", fstrn, fstrx);
>> + }
>
> This won't actually work for strfromf128, only snprintf. strfrom
> functions don't take printf flags (' ') here, or '*' as precision. So
> there is more work to do to adapt this to generate strings in a way that
> will actually work for float128.
>
>> @@ -851,10 +865,17 @@ check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
>> print_float (expected);
>> if (print_diff)
>> {
>> - printf (" difference: % .*" PRINTF_EXPR " % .*" PRINTF_XEXPR
>> - "\n", TYPE_DECIMAL_DIG - 1, diff, TYPE_HEX_DIG - 1, diff);
>> - printf (" ulp : % .4" PRINTF_NEXPR "\n", ulps);
>> - printf (" max.ulp : % .4" PRINTF_NEXPR "\n", max_ulp);
>> + char dstrn[FSTR_MAX], dstrx[FSTR_MAX];
>> + char ustrn[FSTR_MAX], mustrn[FSTR_MAX];
>> + FTOSTR (dstrn, FSTR_MAX, "% .*" PRINTF_EXPR,
>> + TYPE_DECIMAL_DIG - 1, diff);
>> + FTOSTR (dstrx, FSTR_MAX, "% .*" PRINTF_XEXPR,
>> + TYPE_HEX_DIG - 1, diff);
>> + FTOSTR (ustrn, FSTR_MAX, "% .4" PRINTF_NEXPR, ulps);
>> + FTOSTR (mustrn, FSTR_MAX, "% .4" PRINTF_NEXPR, max_ulp);
>
> Again, using printf ' ' flag isn't valid for strfrom functions.
Indeed. TS 18661's dereliction of printf and company is annoying, but kind of
understandable. Anyhow, I've also updated the change log to note that it
*almost* enables dropin replacement.
Committed as 5f7b8f4.