This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
other/5752: Zeros not displayed as significant figures
- From: warren at eng dot up dot ac dot za
- To: gcc-gnats at gcc dot gnu dot org
- Date: 22 Feb 2002 16:19:44 -0000
- Subject: other/5752: Zeros not displayed as significant figures
- Reply-to: warren at eng dot up dot ac dot za
>Number: 5752
>Category: other
>Synopsis: Zeros not displayed as significant figures
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: mistaken
>Submitter-Id: net
>Arrival-Date: Fri Feb 22 08:26:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Warren du Plessis
>Release: 1.0
>Organization:
>Environment:
Linux Mandrake 8 and 8.1
Kernel 2.4.6-26mdk - but other versions of the kernel give the same results.
gcc version 2.96 (Linux-Mandrake 8.0 2.96-0.48mdk) and 3.0
>Description:
The %g output format specifier does not display zeros as significant figures. This is not correct because a zero is generally displayed if it is accurate. For example a value of 1 should be displayed as '1.0' to two significant figures (%.2g) because the zero is accurate, but it displays it as '1'. The %f output format specifier does not have this problem and displays zeros as necessary (1 will display as 1.0 under %.1f).
>How-To-Repeat:
Compile the sample program and run it!
I used 'gcc -o test test.c' to compile it.
>Fix:
Don't know... I was hoping some kind soul out there would help.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/x-csrc; name="test.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test.c"
LyogQSBwcm9ncmFtIHRvIHNob3cgdGhlIHByb2JsZW0gd2l0aCBzaWduaWZpY2FudCBmaWd1cmVz
CiAgIENvbXBpbGUgd2l0aDogZ2NjIC1vIGx1bXBlZCBsdW1wZWQuYwogICBWZXJzaW9uIDEuMAog
ICBXcml0dGVuIGJ5OiBXLlAuIGR1IFBsZXNzaXMKICAgICAgICAgICBvbjogMjAwMi0wMi0yMiAq
LwoKI2luY2x1ZGU8c3RkaW8uaD4KCmludCBtYWluKCkKewogIGludCBjb3VudDE7CiAgZG91Ymxl
IHZhbHVlOwoKICBmb3IgKGNvdW50MSA9IDE7IGNvdW50MSA8PSAxMDsgY291bnQxKyspCiAgICB7
CiAgICAgIHZhbHVlID0gY291bnQxOwogICAgICBwcmludGYoIiVkXHQlLjZnXHQlLjZmXG4iLCBj
b3VudDEsIHZhbHVlLCB2YWx1ZSk7CiAgICB9CgogIHJldHVybiAwOwp9Cg==