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

--- Comment #7 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
(In reply to Thomas Henlich from comment #6)
--- snip ---
> Just some thoughts:
> 
> Have you tried "%LA" for long double?
> 
> Have you tried quadmath_snprintf
> (https://gcc.gnu.org/onlinedocs/libquadmath/quadmath_005fsnprintf.html) with
> "%QA" for quad precision?

That was the hint I needed.

#include <stdio.h>
int main()
  {
     float x =       1.0f / 3.0f;
     double y =      1.0l / 3.0l;
     long double z = 1.0L / 3.0L;
     printf("   FLOAT: %.18A\n", x);
     printf("  DOUBLE: %.18lA\n", y);
     printf("LONG DBL: %.18LA\n", z);
     printf("          123456789012345678901234567890\n");
     printf("   FLOAT: %.20f\n", x);
     printf("  DOUBLE: %.20lf\n", y);
     printf("LONG DBL: %.20Lf\n", z);
  }

$ gcc hexfloat.c 
$ ./a.out 
   FLOAT: 0X1.555556000000000000P-2
  DOUBLE: 0X1.555555555555500000P-2
LONG DBL: 0XA.AAAAAAAAAAAAAAB000P-5
          123456789012345678901234567890
   FLOAT: 0.33333334326744079590
  DOUBLE: 0.33333333333333331483
LONG DBL: 0.33333333333333333334

I will check the libqudmath version as well.

Thanks.

Reply via email to