Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-10-19 08:13:02

"Paul Mensonides" <pmenso57_at_[hidden]> writes:

> Just a quick query about what you guys think should be done in overflow
> situations with high-precision arithmetic in the preprocessor library. I
> have three options:
> 1) return a known (and detectable) error state
> 2) saturate at the greatest value
> 3) cause a glorious preprocessor failure
> I don't like Option 1 very much because nobody is actually going to check
> for overflow, and I can't afford the cost of doing the check inside the
> implementation so I can propogate the error state.
> Option 2 uses saturation arithmetic like the current library arithmetic
> does. (I.e. any attempt to increase above +9,999,999,999 results in
> +9,999,999,999, and any attempt to decrease below -9,999,999,999 results
> in -9,999,999,999.)
> Option 3 is the most efficient and overflow currently won't happen unless an
> attempt is made to go past positive or negative 9,999,999,999.

I don't know what you mean by option 3. If it causes a glorious and
loud preprocessor failure, I like that best. If it fails silently, I
am somwhat ambivalent.

                    David Abrahams
dave_at_[hidden] *
Building C/C++ Extensions for Python: Dec 9-11, Austin, TX

Boost list run by bdawes at, gregod at, cpdaniel at, john at