From owner-freebsd-hackers Sat May 31 00:50:54 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id AAA12258 for hackers-outgoing; Sat, 31 May 1997 00:50:54 -0700 (PDT) Received: from sax.sax.de (sax.sax.de [193.175.26.33]) by hub.freebsd.org (8.8.5/8.8.5) with SMTP id AAA12253 for ; Sat, 31 May 1997 00:50:52 -0700 (PDT) Received: (from uucp@localhost) by sax.sax.de (8.6.12/8.6.12-s1) with UUCP id JAA18867; Sat, 31 May 1997 09:50:49 +0200 Received: (from j@localhost) by uriah.heep.sax.de (8.8.5/8.8.5) id JAA10983; Sat, 31 May 1997 09:28:37 +0200 (MET DST) Message-ID: <19970531092837.DA51579@uriah.heep.sax.de> Date: Sat, 31 May 1997 09:28:37 +0200 From: j@uriah.heep.sax.de (J Wunsch) To: hackers@FreeBSD.ORG (freebsd-hackers) Cc: un_x@anchorage.net (Steve Howe) Subject: Re: bcc vs cc/gcc (float) References: X-Mailer: Mutt 0.60_p2-3,5,8-9 Mime-Version: 1.0 X-Phone: +49-351-2012 669 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) In-Reply-To: ; from Steve Howe on May 30, 1997 12:30:45 -0800 Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk As Steve Howe wrote: > i have taken a great deal of time creating this code to > show this point - and it should compile cleanly as is > under bcc/cc/gcc. Borland C (4.51) can run this code > without any loss of accuracy. please CC me, i'm not > subscribed. Well, you should perhaps have posted the expected output... instead of relying on people having a Borland C. (Btw., ``bcc'' here usually refers to ``Bruce's C compiler'' which can be found in the FreeBSD ports collection, and is expected to be older than Borland's use of the term `bcc'. ;-) I'm not much surprised that the use of non-standard components (long double) produces unexpected results. You multiply a long double with a double (result of pow()), so who tells you whether the compiler does it by first extending the result of pow() to long double format (thus `inventing' missing precision digits), or by first truncating the long double (although i wouldn't expect this)? > void main (unsigned char argc, unsigned char **argv) { Don't get caught in comp.lang.c with this. :) It's an invalid definition of main, thus the behaviour is implementation-dependant. gcc could have exited immediately without violating the standard. The only valid declarations of main() are: int main(int, char **) int main(void) Also, your blatant use of unsigned char for everything doesn't look right. At least with gcc, using an unsigned char as a loop index counter isn't doing any good and is likely to slow down your code. It doesn't save space at all, since (i think) %dh, %dl, and %edx are all a single register for gcc, regardless of how many bits you're using. -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)