This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH v2] libstdc++: Add hexfloat/defaultfloat io manipulators.
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: Jonathan Wakely <jwakely at redhat dot com>
- Cc: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org, Rüdiger Sonderfeld <ruediger at c-plusplus dot de>, Luke Allardyce <lukeallardyce at gmail dot com>
- Date: Wed, 08 Oct 2014 13:27:32 +0200
- Subject: Re: [PATCH v2] libstdc++: Add hexfloat/defaultfloat io manipulators.
- Authentication-results: sourceware.org; auth=none
- References: <20140327133723 dot GA13599 at redhat dot com> <1901588 dot qodTErPe42 at descartes> <20140327162714 dot GA13192 at redhat dot com> <CAFW6PZC0u5=i-KqQZZsbkmg5iWr6u2WVnnBQVqG8V2Bt6oOzOg at mail dot gmail dot com> <20141006155615 dot GN4197 at redhat dot com>
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