From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <615bb2c21f211025b5d9aba799fffe0d@terzarima.net> From: Charles Forsyth Date: Tue, 1 Dec 2009 16:31:14 +0000 To: 9fans@9fans.net In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] compiler double bug. Topicbox-Message-UUID: a61b2c8e-ead5-11e9-9d60-3106f5b1d025 #include #include void main(void) { double g = 4215866817.; print("%d\n", (unsigned int)g); print("%d\n", (unsigned int)g); exits(""); } 8c r.c 8l r.8 ./8.out -79100479 -79100479 no trap. it generates different code. (obviously the %d should be %ud in this case, giving doppio% 8.out 4215866817 4215866817 which looks like the right answer the cast must be to an unsigned integer. otherwise the resulting range is signed, and that's more limited