public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/11475] New: support for printing/reading decimal numbers (_Decimal64)
@ 2010-04-07  8:40 zimmerma+gcc at loria dot fr
  2010-04-07  9:11 ` [Bug libc/11475] " vincent+libc at vinc17 dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: zimmerma+gcc at loria dot fr @ 2010-04-07  8:40 UTC (permalink / raw)
  To: glibc-bugs

as far as I know, the current glibc does not print/read decimal formats
(_Decimal64 for example). Is there any plan to support this?

Example code:
#include <stdio.h>

int
main()
{
  double d = 0.1;
  _Decimal64 e = 0.1;
  printf ("%.20f\n", d);
  printf ("%.20f\n", e);
}

gives:

tarte% gcc bug.c
tarte% ./a.out 
0.10000000000000000555
0.00000000000000000000

We expect 0.10000000000000000000 for the second output.

-- 
           Summary: support for printing/reading decimal numbers
                    (_Decimal64)
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: zimmerma+gcc at loria dot fr
                CC: glibc-bugs at sources dot redhat dot com


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/11475] support for printing/reading decimal numbers (_Decimal64)
  2010-04-07  8:40 [Bug libc/11475] New: support for printing/reading decimal numbers (_Decimal64) zimmerma+gcc at loria dot fr
@ 2010-04-07  9:11 ` vincent+libc at vinc17 dot org
  2010-04-07  9:12 ` vincent+libc at vinc17 dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: vincent+libc at vinc17 dot org @ 2010-04-07  9:11 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From vincent+libc at vinc17 dot org  2010-04-07 09:11 -------
The code is invalid. %f takes an argument of type double, not a _Decimal64. You
need the D modifier (see WG14/N1312, 9.5 Formatted input/output specifiers), e.g.
%Df.

-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/11475] support for printing/reading decimal numbers (_Decimal64)
  2010-04-07  8:40 [Bug libc/11475] New: support for printing/reading decimal numbers (_Decimal64) zimmerma+gcc at loria dot fr
  2010-04-07  9:11 ` [Bug libc/11475] " vincent+libc at vinc17 dot org
@ 2010-04-07  9:12 ` vincent+libc at vinc17 dot org
  2010-04-07  9:16 ` zimmerma+gcc at loria dot fr
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: vincent+libc at vinc17 dot org @ 2010-04-07  9:12 UTC (permalink / raw)
  To: glibc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vincent+libc at vinc17 dot
                   |                            |org


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/11475] support for printing/reading decimal numbers (_Decimal64)
  2010-04-07  8:40 [Bug libc/11475] New: support for printing/reading decimal numbers (_Decimal64) zimmerma+gcc at loria dot fr
  2010-04-07  9:11 ` [Bug libc/11475] " vincent+libc at vinc17 dot org
  2010-04-07  9:12 ` vincent+libc at vinc17 dot org
@ 2010-04-07  9:16 ` zimmerma+gcc at loria dot fr
  2010-04-07  9:17 ` vincent+libc at vinc17 dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: zimmerma+gcc at loria dot fr @ 2010-04-07  9:16 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From zimmerma+gcc at loria dot fr  2010-04-07 09:15 -------
Vincent, you are right. With printf ("%.20Df\n", e) I get:

tarte% gcc bug.c
tarte% ./a.out 
0.10000000000000000555
%.20Df

which is not very useful...

Paul

-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/11475] support for printing/reading decimal numbers (_Decimal64)
  2010-04-07  8:40 [Bug libc/11475] New: support for printing/reading decimal numbers (_Decimal64) zimmerma+gcc at loria dot fr
                   ` (2 preceding siblings ...)
  2010-04-07  9:16 ` zimmerma+gcc at loria dot fr
@ 2010-04-07  9:17 ` vincent+libc at vinc17 dot org
  2010-04-07  9:25 ` vincent+libc at vinc17 dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: vincent+libc at vinc17 dot org @ 2010-04-07  9:17 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From vincent+libc at vinc17 dot org  2010-04-07 09:17 -------
With a corrected code:

#include <stdio.h>

int main (void)
{
  double d = 0.1;
  _Decimal64 e = 0.1;
  printf ("%.20f\n", d);
  printf ("%Da\n", e);
  printf ("%De\n", e);
  printf ("%Df\n", e);
  printf ("%Dg\n", e);
  return 0;
}

currently gives:

0.10000000000000000555
%Da
%De
%Df
%Dg

-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/11475] support for printing/reading decimal numbers (_Decimal64)
  2010-04-07  8:40 [Bug libc/11475] New: support for printing/reading decimal numbers (_Decimal64) zimmerma+gcc at loria dot fr
                   ` (3 preceding siblings ...)
  2010-04-07  9:17 ` vincent+libc at vinc17 dot org
@ 2010-04-07  9:25 ` vincent+libc at vinc17 dot org
  2010-04-07  9:38 ` schwab at linux-m68k dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: vincent+libc at vinc17 dot org @ 2010-04-07  9:25 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From vincent+libc at vinc17 dot org  2010-04-07 09:25 -------
Also, this doesn't matter now, but if accuracy needs to be taken into account
(once this is implemented), one should use

  _Decimal64 e = 0.1dd;

for the tests, instead of:

  _Decimal64 e = 0.1;

-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/11475] support for printing/reading decimal numbers (_Decimal64)
  2010-04-07  8:40 [Bug libc/11475] New: support for printing/reading decimal numbers (_Decimal64) zimmerma+gcc at loria dot fr
                   ` (4 preceding siblings ...)
  2010-04-07  9:25 ` vincent+libc at vinc17 dot org
@ 2010-04-07  9:38 ` schwab at linux-m68k dot org
  2010-04-07 13:30 ` drepper at redhat dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: schwab at linux-m68k dot org @ 2010-04-07  9:38 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From schwab at linux-m68k dot org  2010-04-07 09:37 -------
*** Bug 11476 has been marked as a duplicate of this bug. ***

-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/11475] support for printing/reading decimal numbers (_Decimal64)
  2010-04-07  8:40 [Bug libc/11475] New: support for printing/reading decimal numbers (_Decimal64) zimmerma+gcc at loria dot fr
                   ` (5 preceding siblings ...)
  2010-04-07  9:38 ` schwab at linux-m68k dot org
@ 2010-04-07 13:30 ` drepper at redhat dot com
  2010-04-07 15:30 ` vincent+libc at vinc17 dot org
  2010-04-28  8:15 ` zimmerma+gcc at loria dot fr
  8 siblings, 0 replies; 11+ messages in thread
From: drepper at redhat dot com @ 2010-04-07 13:30 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2010-04-07 13:30 -------
This is what the printf hooks are for.  I'm not going to add any such
non-standard conversion.  It far too dangerous a compability risk going forward.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/11475] support for printing/reading decimal numbers (_Decimal64)
  2010-04-07  8:40 [Bug libc/11475] New: support for printing/reading decimal numbers (_Decimal64) zimmerma+gcc at loria dot fr
                   ` (6 preceding siblings ...)
  2010-04-07 13:30 ` drepper at redhat dot com
@ 2010-04-07 15:30 ` vincent+libc at vinc17 dot org
  2010-04-28  8:15 ` zimmerma+gcc at loria dot fr
  8 siblings, 0 replies; 11+ messages in thread
From: vincent+libc at vinc17 dot org @ 2010-04-07 15:30 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From vincent+libc at vinc17 dot org  2010-04-07 15:30 -------
The conversion is currently non-standard, but it may become standard in the
future. At that time, the status of this bug will have to be revised.

-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/11475] support for printing/reading decimal numbers (_Decimal64)
  2010-04-07  8:40 [Bug libc/11475] New: support for printing/reading decimal numbers (_Decimal64) zimmerma+gcc at loria dot fr
                   ` (7 preceding siblings ...)
  2010-04-07 15:30 ` vincent+libc at vinc17 dot org
@ 2010-04-28  8:15 ` zimmerma+gcc at loria dot fr
  8 siblings, 0 replies; 11+ messages in thread
From: zimmerma+gcc at loria dot fr @ 2010-04-28  8:15 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From zimmerma+gcc at loria dot fr  2010-04-28 08:15 -------
(In reply to comment #6)
> This is what the printf hooks are for.  I'm not going to add any such
> non-standard conversion.  It far too dangerous a compability risk going forward.

Dear Ulrich, please can you explain why this is "non-standard". With respect to
which standard? Is _Decimal64 standard?

Also, if someone provides changes to scanf/printf based on functions already
existing in libbid or libdecnumber (currently used internally by gcc) for
conversions between strings and decimal formats, would them be included in glibc?


-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/11475] support for printing/reading decimal numbers (_Decimal64)
       [not found] <bug-11475-131@http.sourceware.org/bugzilla/>
@ 2014-06-30 18:18 ` fweimer at redhat dot com
  0 siblings, 0 replies; 11+ messages in thread
From: fweimer at redhat dot com @ 2014-06-30 18:18 UTC (permalink / raw)
  To: glibc-bugs

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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

--- Comment #9 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
Subject: Re:  support for printing/reading decimal numbers
 (_Decimal64)

On Wed, 28 Apr 2010, zimmerma+gcc at loria dot fr wrote:

> ------- Additional Comments From zimmerma+gcc at loria dot fr  2010-04-28 08:15 -------
> (In reply to comment #6)
> > This is what the printf hooks are for.  I'm not going to add any such
> > non-standard conversion.  It far too dangerous a compability risk going forward.
> 
> Dear Ulrich, please can you explain why this is "non-standard". With respect to
> which standard? Is _Decimal64 standard?

A Technical Report Type 2 (such as TR 24732) is not a standard or an 
amendment to a standard.

> Also, if someone provides changes to scanf/printf based on functions already
> existing in libbid or libdecnumber (currently used internally by gcc) for
> conversions between strings and decimal formats, would them be included in glibc?

The functionality is in the libfdp add-on.  This is an example of what the 
add-on mechanism is for; it doesn't need to be in the core libc.  (I 
imagine the libdfp people will propose a scanf hook facility at some point 
to allow that part to be fully implemented in an add-on.  One remaining 
DFP requirement relates to the predefined macro __STDC_DEC_FP__ but 
unfortunately my proposal for a change which would also allow that to be 
handled entirely within the add-on has stalled; see bug 10110.)



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


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

end of thread, other threads:[~2014-06-30 18:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-07  8:40 [Bug libc/11475] New: support for printing/reading decimal numbers (_Decimal64) zimmerma+gcc at loria dot fr
2010-04-07  9:11 ` [Bug libc/11475] " vincent+libc at vinc17 dot org
2010-04-07  9:12 ` vincent+libc at vinc17 dot org
2010-04-07  9:16 ` zimmerma+gcc at loria dot fr
2010-04-07  9:17 ` vincent+libc at vinc17 dot org
2010-04-07  9:25 ` vincent+libc at vinc17 dot org
2010-04-07  9:38 ` schwab at linux-m68k dot org
2010-04-07 13:30 ` drepper at redhat dot com
2010-04-07 15:30 ` vincent+libc at vinc17 dot org
2010-04-28  8:15 ` zimmerma+gcc at loria dot fr
     [not found] <bug-11475-131@http.sourceware.org/bugzilla/>
2014-06-30 18:18 ` 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).