public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/13958] New: printf(3) format spec "%La" generates odd output (at least on x86)
@ 2012-04-06 19:50 cloos at jhcloos dot com
  2012-04-06 20:08 ` [Bug libc/13958] " schwab@linux-m68k.org
  2014-06-25 11:20 ` fweimer at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: cloos at jhcloos dot com @ 2012-04-06 19:50 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=13958

             Bug #: 13958
           Summary: printf(3) format spec "%La" generates odd output (at
                    least on x86)
           Product: glibc
           Version: 2.14
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: unassigned@sourceware.org
        ReportedBy: cloos@jhcloos.com
                CC: drepper.fsp@gmail.com
    Classification: Unclassified


Some examples:

double: 1 (0x1p+0)
long double: 1 (0x8p-3)

double: 1.5 (0x1.8p+0)
long double: 1.5 (0xcp-3)

I presume this is related to the 80-bit representation’s lack of an implied
bit?

I noticed this while looking at bug #13940; this is based on Andreas’ code in
comment #1 there:


#include <stdlib.h>
#include <stdio.h>
int
main (int c, char *v[])
{
  float f;
  double d;
  long double ld;

  ld = -1.0L;
  if (c > 1)
        ld = strtold (v[1], NULL);

  f = (float)ld;
  d = (double)ld;

  printf ("float %.8g (%a)\n", f,f);
  printf ("double %.16g (%a)\n", d,d);
  printf ("long double %.20Lg (%La)\n", ld, ld);

  return 0;
}

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-25 11:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-06 19:50 [Bug libc/13958] New: printf(3) format spec "%La" generates odd output (at least on x86) cloos at jhcloos dot com
2012-04-06 20:08 ` [Bug libc/13958] " schwab@linux-m68k.org
2014-06-25 11:20 ` fweimer at redhat dot com

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).