Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!nike!ucbcad!ucbvax!Xerox.COM!Opstad.osbunorth From: Opstad.osbunorth@Xerox.COM Newsgroups: net.micro.atari16 Subject: Division problem with Lattice C Message-ID: <860824-115320-1121@Xerox> Date: Sun, 24-Aug-86 14:52:53 EDT Article-I.D.: Xerox.860824-115320-1121 Posted: Sun Aug 24 14:52:53 1986 Date-Received: Sun, 24-Aug-86 19:48:37 EDT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 20 I discovered this little problem while writing a prime factorization program. Consider the following fragment: unsigned long i; i = 16777216L; printf("%ld\n", i); i /= 2; printf("%ld\n", i); Imagine my surprise when the same number is printed by both printf calls! When I changed the fourth line to: i >>= 1; the program worked fine and printed the correct results. Has anyone else had problems with division using Lattice/Metacomco C? (I'm using version 3.03.04) Dave Opstad (Opstad.osbunorth@Xerox.COM)