Xref: utzoo comp.unix.microport:542 comp.bugs.sys5:432 Path: utzoo!mnetor!uunet!mcvax!unido!altger!dirk From: dirk@altger.UUCP (dirk) Newsgroups: comp.unix.microport,comp.bugs.sys5 Subject: 386/ix bug on doubles inside if-statement ? Message-ID: <672@altger.UUCP> Date: 25 Apr 88 16:10:33 GMT Reply-To: dirk@altger.UUCP (dirk) Organization: Altos Computer Systems Munich Lines: 33 Does anyboady have an idea why the following program fails ? It seems as the compiler can not handle functions which return a double inside an 'if' statement. I've tested it under the Interactive UNIX Sys. V rel. 3 v. 1.0.3 port to the iAPX386 and Microport's version 2.1. Both failed. Only the Silicon Valley IN80386 'C' compiler works fine, thus the bug can not be in the libraries. A workaround is to use dummy variables inside the if statement. cu, dirk :-) ..unido!cosa!dirk %% #include main() { double a, b, bugI, bugII; a= -3.1415; b= 0.00001; printf ("|a|= %lf\n", fabs (a)); printf ("|b|= %lf\n", fabs (b)); if (fabs (a) < fabs (b)) printf ("1. a is lower\n"); if ((bugI= fabs (a)) < (bugII= fabs (b))) printf ("2. a is lower\n"); printf ("3. %c is lower\n", fabs (a) < fabs (b)?'a':'b'); } %%