From owner-freebsd-questions Wed Mar 17 15:16:19 1999 Delivered-To: freebsd-questions@freebsd.org Received: from alpha.comkey.com.au (alpha.comkey.com.au [203.9.152.215]) by hub.freebsd.org (Postfix) with SMTP id 582A015222 for ; Wed, 17 Mar 1999 15:16:04 -0800 (PST) (envelope-from gjb@comkey.com.au) Received: (qmail 9019 invoked by uid 1001); 17 Mar 1999 21:07:24 -0000 Message-ID: <19990317210724.9018.qmail@alpha.comkey.com.au> X-Posted-By: GBA-Post 1.04 06-Feb-1999 X-PGP-Fingerprint: 5A91 6942 8CEA 9DAB B95B C249 1CE1 493B 2B5A CE30 Date: Thu, 18 Mar 1999 07:07:23 +1000 From: Greg Black To: spinner.rflab@t-online.de (Steffen Hein) Cc: freebsd-questions@FreeBSD.ORG Subject: Re: gnu C compiler References: <36EFA9ED.5126E95C@t-online.de> In-reply-to: <36EFA9ED.5126E95C@t-online.de> of Wed, 17 Mar 1999 13:11:09 GMT Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > How can you explain me that the same gnu C compiler ( release 2.7.2.1 ) > in FreeBSD apparently does not handle the long double format correctly > while in Linux it does ? No idea about Linux, but your program is wrong so any results are legitimate. > Compiling the following program 'proto.c' in FreeBSD and in Linux as > # cc -ansi proto.c -o proto.a Learn to use gcc's warnings (at the very least -Wall), and you'll see where your code is incorrect. I've snipped most of this code, but there are several other poor C coding practices not related to the stated problem which should also be addressed. Further help can be obtained from good books and places like comp.lang.c, since C coding is not really a topic for freebsd-questions. > printf( "\n\n FLT_MIN = % le ", FLT_MIN); ^ This is wrong ----------------------^ Leave out the `l'. It's not correct for the `e' conversion. > printf( "\n LDBL_MIN = % Le ", LDBL_MIN ); This is wrong, as gcc would have told you with -Wall: you are passing a `double' to printf() but telling it you are passing a `long double'. If you lie to the compiler, then it will get its revenge. If you cast LDBL_MIN and friends to the correct type, then your program will run to completion. -- Greg Black To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message