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.

Reply via email to