public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jvdelisle at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libfortran/48651] DTOA float conversion issue Date: Sun, 17 Apr 2011 18:29:00 -0000 [thread overview] Message-ID: <bug-48651-4-so7FnLJNLz@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-48651-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48651 --- Comment #2 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-04-17 18:28:55 UTC --- hmm, notice the typo! i have set ldnum to 0.0 but it still is printing the value of dnum. What am I doing wrong. $ cat sprint.c #include <stdio.h> int main () { float num = 0.9; double dnum = 0.9; long double ldnum = 25.6; printf("%50.48f\n", num); printf("%50.48lf, %d\n", num, sizeof(num)); printf("%80.78f\n", dnum); printf("%80.78lf, %d\n", dnum, sizeof(dnum)); printf("%80.78f\n", ldnum); printf("%80.78lf, %d\n", ldnum, sizeof(ldnum)); } [jerry@quattro pr48602]$ cat sprint.c #include <stdio.h> int main () { float num = 0.9; double dnum = 0.9; long double ldnum = 25.6; printf("%50.48f\n", num); printf("%50.48lf, %d\n", num, sizeof(num)); printf("%80.78f\n", dnum); printf("%80.78lf, %d\n", dnum, sizeof(dnum)); printf("%80.78f\n", ldnum); printf("%80.78lf, %d\n", ldnum, sizeof(ldnum)); } [jerry@quattro pr48602]$ ./a.out 0.899999976158142089843750000000000000000000000000 0.899999976158142089843750000000000000000000000000, 4 0.900000000000000022204460492503130808472633361816406250000000000000000000000000 0.900000000000000022204460492503130808472633361816406250000000000000000000000000, 8 0.900000000000000022204460492503130808472633361816406250000000000000000000000000 0.900000000000000022204460492503130808472633361816406250000000000000000000000000, 16 The value of ldnum is not surviving.
next prev parent reply other threads:[~2011-04-17 18:29 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-04-17 14:00 [Bug libfortran/48651] New: " jvdelisle at gcc dot gnu.org 2011-04-17 18:07 ` [Bug libfortran/48651] " jvdelisle at gcc dot gnu.org 2011-04-17 18:29 ` jvdelisle at gcc dot gnu.org [this message] 2011-04-17 18:34 ` thenlich at users dot sourceforge.net 2011-04-17 19:03 ` jvdelisle at gcc dot gnu.org 2011-04-17 23:39 ` kargl at gcc dot gnu.org 2011-04-18 2:49 ` jvdelisle at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-48651-4-so7FnLJNLz@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).