Travis Vitek-4 wrote:
>
>
>
>>Martin Sebor wrote:
>>
>>Yes, although it's not immediately obvious to me what the problem
>>is, The first assertion above corresponds to this line:
>>
>> TEST (T, 1.1, 0, 0, 0, ' ', "", "%g");
>>
>>I don't see where the test ends up formatting 1.1 as 1.1 using the
>>"%g" directive (on AIX, printf("%g", 1.1) produces 1 as expected.
>>
>
> Uh, it most certainly does not.
>
>
You're right, I was looking at the output of %.g. Looks like we need
to replace the "%g" with "%.0g" here. Let me take care of that.
>
> $ cat t.cpp
> #include <stdio.h>
>
> int main (int argc, char* argv [])
> {
> const float f = 1 < argc ? atof (argv [1]) : 1.1;
>
> printf ("%g\n", f);
> printf ("%.0g\n", f); // should be same as %.1g
> printf ("%.1g\n", f);
> printf ("%.2g\n", f);
> printf ("%.3g\n", f);
> printf ("%.4g\n", f);
> printf ("%.5g\n", f);
> printf ("%.6g\n", f);
> printf ("%.7g\n", f);
> printf ("%.8g\n", f);
> printf ("%.9g\n", f);
> return 0;
> }
>
> $ xlC t.cpp && a.out 1.1
> 1.1
> 1
> 1
> 1.1
> 1.1
> 1.1
> 1.1
> 1.1
> 1.1
> 1.1
> 1.10000002
>
> Travis
>
>
>>Martin
>>
>
>
--
View this message in context:
http://www.nabble.com/-PATCH--punct.cpp-tp15716394p16010982.html
Sent from the stdcxx-dev mailing list archive at Nabble.com.