From mboxrd@z Thu Jan 1 00:00:00 1970 From: tlaronde@polynum.com Date: Mon, 19 Apr 2010 20:15:33 +0200 To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Message-ID: <20100419181533.GA2071@polynum.com> References: <20100419154317.GA726@polynum.com> <20100419161143.GA1377@shodan.homeunix.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100419161143.GA1377@shodan.homeunix.net> User-Agent: Mutt/1.4.2.3i Subject: Re: [9fans] Rounding off by one Topicbox-Message-UUID: 09981308-ead6-11e9-9d60-3106f5b1d025 On Mon, Apr 19, 2010 at 06:11:43PM +0200, Martin Neubauer wrote: > * tlaronde@polynum.com (tlaronde@polynum.com) wrote: > > While verifying that I have the same result under Plan9 than under some > > Unix (NetBSD), it happens that METAFONT compiles 110 of the 125 fontes, > > but hence fails on some (and it should not) with something that smells > > like a round off by one error on negative integer division. There is no > > problem with TeX, but TeX doesn't do the same things. > This might not be related to your problem, but during the recent > discussion of Plan 9's future /sys/src/cmd/cc/c99 was mentioned. > Reference 25 (in section "Not done") at least seems to be a good > candidate for a test case between Plan 9 and NetBSD compilers. Thanks for the note. But I think I have found the problem: a division by 2 supposed to be "floor" and that slips as (x + y) / 2: is there anything that guarantees that the result shall be floor, ceil or nearest? I find nothing in C89. If this is the case, (x + y) >> 1 will be the solution (suggested by Donald E. Knuth in the METAFONTbook by the way), and that could be an explanation of why it works with gcc, because it optimizes this. I hope this is it, since I will finally be able to publish... Cheers, -- Thierry Laronde http://www.kergis.com/ Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C