From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6472B3858023; Tue, 23 Feb 2021 16:55:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6472B3858023 From: "ppalka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/98384] [11 Regression] new test case 20_util/to_chars/long_double.cc in r11-6249 fails on powerpc64 BE Date: Tue, 23 Feb 2021 16:55:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ppalka at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: ppalka at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Feb 2021 16:55:42 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98384 --- Comment #11 from Patrick Palka --- (In reply to Jakub Jelinek from comment #9) > I think glibc %a printing uses 0x1.xxxx (for normalized values) at least = for > float/double and the IEEE quad long doubles, but uses 0xf.xxxx printing e= tc. > for the 80-bit long doubles. My personal preference would be to always u= se > 0x1.xxxx for normalized numbers and for denormals 0x0.xxxx, I think it is > less surprising to users, and transforming one form to another is pretty > easy. Yeah, currently to_chars hex output mimics glibc's choice of leading hex di= git. But always using 0/1, even for 80-bit long double sounds good to me too. FWIW, I think the shortest hex form for some number is at most 3 characters shorter than any other conforming hex form, e.g. 1.2p+12 vs 9p+9. > And agree on the tests just trying to parse the returned string back to s= ee > if it is the original value. I posted a patch at https://gcc.gnu.org/pipermail/gcc-patches/2021-February/565726.html that do= es this, but also salvages the verification via printf by first checking if the leading hex digit of the printf output agrees with that of to_chars.=20 Conveniently, the patch sidesteps the question of choosing a consistent representation vs shortest representation :)=