[PATCH v2] libstdc++: Add hexfloat/defaultfloat io manipulators.

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Wed Oct 8 11:27:00 GMT 2014


Jonathan Wakely <jwakely@redhat.com> writes:

> On 28/03/14 08:56 +0900, Luke Allardyce wrote:
>>It looks like the new standard also requires the precision to be
>>ignored for hexfloat
>>
>>>For conversion from a floating-point type, if floatfield !=
>> (ios_base::fixed | ios_base:: scientific), str.precision() is specified
>> as precision in the conversion specification. Otherwise, no precision is
>> specified.
>
> I've made this change and adjusted the test so that it doesn't make
> any assumptions about the exact format of hexadecimal float output, as
> it's unspecified whether you get e.g. 0x1.ep+3 or 0xfp+0 for 15.
>
> As Luke pointed out, this changes the behaviour of some valid C++03
> programs, but I think that's the right thing to do in this case. I'll
> document that in the release notes.
>
> Tested x86_64-linux, committed to trunk.

On Solaris 11 (both SPARC and x86), the test execution FAILs:

Assertion failed: os && std::stod(os.str()) == d, file /vol/gcc/src/hg/trunk/local/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc, line 51, function test01
FAIL: 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc execution test

With -DTEST_NUMPUT_VERBOSE, I get

got: 0x1.0000000000000p-1074

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University



More information about the Gcc-patches mailing list