This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]