From mboxrd@z Thu Jan 1 00:00:00 1970 From: andrey mirtchovski To: 9fans@cse.psu.edu Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: [9fans] factor.c bug (+ fix) Date: Mon, 23 Jun 2003 13:16:31 -0600 Topicbox-Message-UUID: d822b512-eacb-11e9-9e20-41e7f4b1d025 factor.c crashes (in _floatfmt) when given a sufficiently large number. i've added a check similar to the one in primes.c that fixed the problem: plan9% diff factor.c /sys/src/cmd/factor.c 7,8d6 < double big = 9.007199254740992e15; < 45,48d42 < if(n > big) { < print("error: number too big\n"); < break; < } plan9% that makes the program rather noisy, so it may be a good idea to exits("number too big") instead of print()-ing the error message (the program exits silently when given negative numbers, for example). andrey