[Bug libc/23278] New: printf using %a inconsistent

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug libc/23278] New: printf using %a inconsistent

986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=23278

            Bug ID: 23278
           Summary: printf using %a inconsistent
           Product: glibc
           Version: 2.27
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: tydeman.fred at gmail dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

This code

#include <stdio.h>

int main(void){
  (void)printf("%.0a\n", 1.);
  (void)printf("%.0a\n", 2.);
  (void)printf("%.0a\n", 4.);
  (void)printf("%.0a\n", 8.);
  (void)printf("%.0a\n", 16.);
  (void)printf("%.0a\n", 3.);
  (void)printf("%.0a\n", 6.);
  (void)printf("%.0a\n", 12.);
  (void)printf("%.0a\n", 23.);
  (void)printf("%.0a\n", 24.);
  (void)printf("%.0a\n", 25.);
  return 0;
}

shows that printf uses both 1 bit and 2 bits for the integer part before the
'p'
(which seems inconsistent).  My guess is it depends upon rounding up.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug stdio/23278] printf using %a inconsistent

986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=23278

Joseph Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|libc                        |stdio

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug stdio/23278] printf using %a inconsistent

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=23278

--- Comment #1 from Andreas Schwab <[hidden email]> ---
The only requirement is that there is a single nonzero digit before the
hexadecimal point.

--
You are receiving this mail because:
You are on the CC list for the bug.