public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/27988] New: rounding in printf functions is inconsistent
@ 2021-06-16 15:54 mjbecker at web dot de
  2021-06-16 17:03 ` [Bug libc/27988] " schwab@linux-m68k.org
  0 siblings, 1 reply; 2+ messages in thread
From: mjbecker at web dot de @ 2021-06-16 15:54 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=27988

            Bug ID: 27988
           Summary: rounding in printf functions is inconsistent
           Product: glibc
           Version: 2.31
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: mjbecker at web dot de
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

This little program:

#include <stdio.h>

int main()
{
  int i;
  double d;

  d = 1.5;
  for (i=0; i<10; i++) {
    printf("%f: %.0f\n", d, d);
    d += 1;
  }

  return 0;
}

results in this output:

1.500000: 2
2.500000: 2
3.500000: 4
4.500000: 4
5.500000: 6
6.500000: 6
7.500000: 8
8.500000: 8
9.500000: 10
10.500000: 10

I expected either all numbers to be rounded up or all to be rounded down.

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

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

* [Bug libc/27988] rounding in printf functions is inconsistent
  2021-06-16 15:54 [Bug libc/27988] New: rounding in printf functions is inconsistent mjbecker at web dot de
@ 2021-06-16 17:03 ` schwab@linux-m68k.org
  0 siblings, 0 replies; 2+ messages in thread
From: schwab@linux-m68k.org @ 2021-06-16 17:03 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=27988

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |NOTABUG
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
They are rounded to nearest, with ties rounded to even.

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

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

end of thread, other threads:[~2021-06-16 17:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-16 15:54 [Bug libc/27988] New: rounding in printf functions is inconsistent mjbecker at web dot de
2021-06-16 17:03 ` [Bug libc/27988] " schwab@linux-m68k.org

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