Boost logo

Boost :

From: Joel de Guzman (djowel_at_[hidden])
Date: 2002-10-19 06:27:16


----- Original Message -----
From: "Paul Mensonides" <pmenso57_at_[hidden]>

> 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.
>
> Thanks in advance for any comments.

Hi,

Definitely 2.

2c worth
--Joel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk