public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-107815-4-W8yO0LtWti@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107815-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107815

--- Comment #17 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(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 == std::errc() &&
> ptr4 == ptr1' failed.
> ABORT instruction (core dumped)

Ah, ok, so it is a different case, the
    std::numeric_limits<std::float128_t>::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 <stdlib.h>

int
main ()
{
  char *end;
  const char *p = "6e-4966";
  long double l = strtold (p, &end);
  if (l != __LDBL_DENORM_MIN__ || end != p + 7)
    abort ();
  p = "1e-4965";
  l = strtold (p, &end);
  if (l != 2.0L * __LDBL_DENORM_MIN__ || end != p + 7)
    abort ();
  p = "2e-4965";
  l = strtold (p, &end);
  if (l != 3.0L * __LDBL_DENORM_MIN__ || end != 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.

  parent reply	other threads:[~2022-11-28  9:12 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-22 13:46 [Bug libstdc++/107815] New: " ro at gcc dot gnu.org
2022-11-22 13:47 ` [Bug libstdc++/107815] " ro at gcc dot gnu.org
2022-11-22 14:28 ` jakub at gcc dot gnu.org
2022-11-22 16:10 ` ro at CeBiTec dot Uni-Bielefeld.DE
2022-11-22 17:22 ` jakub at gcc dot gnu.org
2022-11-23 13:10 ` ro at CeBiTec dot Uni-Bielefeld.DE
2022-11-23 15:23 ` jakub at gcc dot gnu.org
2022-11-23 15:32 ` redi at gcc dot gnu.org
2022-11-23 15:45 ` jakub at gcc dot gnu.org
2022-11-23 15:58 ` ro at CeBiTec dot Uni-Bielefeld.DE
2022-11-23 16:07 ` jakub at gcc dot gnu.org
2022-11-24  9:03 ` ro at CeBiTec dot Uni-Bielefeld.DE
2022-11-24  9:16 ` jakub at gcc dot gnu.org
2022-11-24  9:38 ` cvs-commit at gcc dot gnu.org
2022-11-24  9:41 ` jakub at gcc dot gnu.org
2022-11-27 20:40 ` dave.anglin at bell dot net
2022-11-27 20:45 ` jakub at gcc dot gnu.org
2022-11-27 21:16 ` dave.anglin at bell dot net
2022-11-28  9:12 ` jakub at gcc dot gnu.org [this message]
2022-11-28  9:39 ` jakub at gcc dot gnu.org
2022-11-28 13:04 ` dave.anglin at bell dot net
2023-04-26  6:57 ` rguenth at gcc dot gnu.org
2023-06-09 12:24 ` redi at gcc dot gnu.org
2023-07-27  9:24 ` rguenth at gcc dot gnu.org
2024-05-21  9:13 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-107815-4-W8yO0LtWti@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).