From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 887A0385514D; Mon, 28 Nov 2022 09:12:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 887A0385514D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669626726; bh=7laLSoxtyaH/2D/2ufJ5gGeVVlXvWSgDGLB+p5BIfMg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LrST/sh2IyyVqnQcvWiIUoOwSMqo+qf3ySnH5Zd0lyGut+Tnt9JOiItqK6lUcplJH 8AhBSCUlb9JLiyfMUQ2VUfMRrO8ZS4J1xuJBhikKFsivhObtEtyyuAVf18yueqQ8QN VHXnv07kvueCh58yOk6trUckyrF8qjhsd5qeZ4pU= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/107815] 20_util/to_chars/float128_c++23.cc FAILs Date: Mon, 28 Nov 2022 09:12:03 +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: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107815 --- Comment #17 from Jakub Jelinek --- (In reply to dave.anglin from comment #16) > This is what the test prints: > 6.47518e-4966 6e-4966 > xxx.cc:79: void test(std::chars_format): Assertion 'ec4 =3D=3D std::errc(= ) && > ptr4 =3D=3D ptr1' failed. > ABORT instruction (core dumped) Ah, ok, so it is a different case, the std::numeric_limits::denorm_min(), one. 6e-4966 is I believe the correct shortest scientific string representation = of the value, because nexttoward{l,f128} of that value in one direction is 0 (= in fixed or 0e+00 in scientific) and in the other direction is 12.95036e-4966 (1e-4965 in shortest scientific) and one further step 19.42554e-4966 (2e-4965 in shortest scientific). What fails is the from_chars for you, and from_chars when not hexadecimal always uses strto* functions, so I presume what HP-UX mishandles is: #include int main () { char *end; const char *p =3D "6e-4966"; long double l =3D strtold (p, &end); if (l !=3D __LDBL_DENORM_MIN__ || end !=3D p + 7) abort (); p =3D "1e-4965"; l =3D strtold (p, &end); if (l !=3D 2.0L * __LDBL_DENORM_MIN__ || end !=3D p + 7) abort (); p =3D "2e-4965"; l =3D strtold (p, &end); if (l !=3D 3.0L * __LDBL_DENORM_MIN__ || end !=3D p + 7) abort (); return 0; } Is that the case? If yes, is denorm_min the only thing that doesn't work? We can then #ifdef= it out for HP-UX with a comment.=