public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cloos at jhcloos dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug libc/13958] New: printf(3) format spec "%La" generates odd output (at least on x86)
Date: Fri, 06 Apr 2012 19:50:00 -0000	[thread overview]
Message-ID: <bug-13958-131@http.sourceware.org/bugzilla/> (raw)

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.


             reply	other threads:[~2012-04-06 19:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-06 19:50 cloos at jhcloos dot com [this message]
2012-04-06 20:08 ` [Bug libc/13958] " schwab@linux-m68k.org
2014-06-25 11:20 ` fweimer at redhat dot com

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-13958-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.com \
    /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).