Article View: gnu.gcc.help
Article #49939Re: strange output
From: Michael Chapman
Date: Wed, 08 Dec 1993 10:43
Date: Wed, 08 Dec 1993 10:43
28 lines
1739 bytes
1739 bytes
In article AA02949@aaron.music.qc.edu, richards@aaron.music.qc.edu (David Richards) writes:
>Hello folks - here's the problem:
>
>#include <stdio.h>
>main()
>{
> long double ldb = 22343546554.435551;
> printf("ldb = %f\n", ldb);
>}
>
>compile with: gcc -o longd longd.c
>BUT THE OUTPUT READS: ldb = 8.500005
>
>Forgive me if I'm dreaming but it looks like a bug to me!!
>Am I missing something that's so painfully obvious that an
>amoeba could see it?!#%@^??
>I'm running on NeXT 3.1- when using cc this doesn't
>happen.
>Dave Richards
The format %f is for doubles not long doubles. If your compiler makes
long doubles and doubles the same then you will not notice the error.
I don't know what the format should be - probably something like %lf
------------------------------------------------------------------------------
Mike Chapman e-mail: mchapman@eis.k8.rt.bosch.de (office)
fax: (+49) 7121/35-1746 Mike.Chapman@isis.seicom.de (home)
tel: (+49) 7121/35-1662 (office)
Technical Details
Message-ID:
<470@boschrt.rt.bosch.de.bosch.de>Path:
arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!Germany.EU.net!rt.bosch.de!argos!mchapmanReferences:
<9312071842.AA02949@aaron.music.qc.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,6f7a036dfb120868 X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-12-08 23:22:28 PST Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!Germany.EU.net!rt.bosch.de!argos!mchapman From: mchapman@eis.k8.rt.bosch.de (Michael Chapman) Newsgroups: gnu.gcc.help Subject: Re: strange output Message-ID: <470@boschrt.rt.bosch.de.bosch.de> Date: 8 Dec 93 10:43:31 GMT References: <9312071842.AA02949@aaron.music.qc.edu> Sender: news@rt.bosch.de.bosch.de Reply-To: mchapman@eis.k8.rt.bosch.de Organization: Robert Bosch GmbH., Reutlingen, Germany. Lines: 49 Nntp-Posting-Host: argos