Re: [boost] BigInt divide-by-zero handling

-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Jonathan Ray Sent: Tuesday, May 16, 2006 3:11 PM To: boost@lists.boost.org Subject: [boost] BigInt divide-by-zero handling
I'm planning to finish the BigInt library for SoC. I'm looking for some input about whether divide-by-zero should throw an exception, or just store a NaN and propagate that through any subsequent operations. Since ordinary ints just throw an exception, and my goal is to make BigInts have virtually the same interface as ints but never overflow, it seems reasonable to throw an exception. Any objections?
Further to my other email, maybe it makes sense to force integer divide by zero. i.e.: In some operator for BigInt: if(divide_by_zero) { int a =5; int b =0; int c=a/b; }

On Tue, May 16, 2006 at 04:48:37PM -0700, Sohail Somani wrote:
Further to my other email, maybe it makes sense to force integer divide by zero. i.e.:
No. You're invoking undefined behaviour. Regards -Gerhard -- Gerhard Wesp ZRH office voice: +41 (0)44 668 1878 ZRH office fax: +41 (0)44 200 1818 For the rest I claim that raw pointers must be abolished.

Gentlemen, I might draw your attention to a thread that has been going on in parallel to this one on the same list which you might find relevent to your current discussion. Its title is: "Stream input and output of NaN and infinity" Robert Ramey Gerhard Wesp wrote:
On Tue, May 16, 2006 at 04:48:37PM -0700, Sohail Somani wrote:
Further to my other email, maybe it makes sense to force integer divide by zero. i.e.:
No. You're invoking undefined behaviour.
Regards -Gerhard
participants (3)
-
Gerhard Wesp
-
Robert Ramey
-
Sohail Somani