This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCHv3 01/11] Begin refactor of libm-test.inc



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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]