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) Message-ID: <19970531092837.DA51579@uriah.heep.sax.de> In-Reply-To: <Pine.BSF.3.95q.970530121334.389A-100000@aak.anchorage.net>; from Steve Howe on May 30, 1997 12:30:45 -0800 References: <Pine.BSF.3.95q.970530121334.389A-100000@aak.anchorage.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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. ;-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970531092837.DA51579>
