[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MSVC compilation problem: std::abs<int64_t> does not exist
From: |
Jaroslav Hajek |
Subject: |
Re: MSVC compilation problem: std::abs<int64_t> does not exist |
Date: |
Thu, 30 Oct 2008 18:55:24 +0100 |
On Thu, Oct 30, 2008 at 6:44 PM, John W. Eaton <address@hidden> wrote:
> On 30-Oct-2008, Jaroslav Hajek wrote:
>
> | No, it's no more buggy than std::abs itself.
>
> Yeah, but it still gives a wrong answer. :-)
>
True. That's why we have a slightly different implementation in
octave_int_arith, that marks the overflow correctly.
However, in the particular place where std::abs is used (inside
octave_int_arith_base<T, true>::div) the overflow cannot occur,
because the argument cannot happen to be equal to
std::numeric_limits<T>::min ().
I have just verified that the expression
(x < 0) ? -x : x produces exaclty the same code as std::abs (x) with
g++ at -O3, so I guess we can use that. But, unless anyone objects,
I'll mark it as a FIXME.
> jwe
>
--
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
- MSVC compilation problem: std::abs<int64_t> does not exist, Michael Goffioul, 2008/10/30
- Re: MSVC compilation problem: std::abs<int64_t> does not exist, Abdelrazak Younes, 2008/10/30
- Re: MSVC compilation problem: std::abs<int64_t> does not exist, John W. Eaton, 2008/10/30
- Re: MSVC compilation problem: std::abs<int64_t> does not exist, Abdelrazak Younes, 2008/10/30
- Re: MSVC compilation problem: std::abs<int64_t> does not exist, Jaroslav Hajek, 2008/10/30
- Re: MSVC compilation problem: std::abs<int64_t> does not exist, John W. Eaton, 2008/10/30
- Re: MSVC compilation problem: std::abs<int64_t> does not exist,
Jaroslav Hajek <=
- Re: MSVC compilation problem: std::abs<int64_t> does not exist, John W. Eaton, 2008/10/30
- Re: MSVC compilation problem: std::abs<int64_t> does not exist, Michael Goffioul, 2008/10/30
- Re: MSVC compilation problem: std::abs<int64_t> does not exist, Jaroslav Hajek, 2008/10/30
- Re: MSVC compilation problem: std::abs<int64_t> does not exist, John W. Eaton, 2008/10/30
- Re: MSVC compilation problem: std::abs<int64_t> does not exist, John W. Eaton, 2008/10/30
- Re: MSVC compilation problem: std::abs<int64_t> does not exist, Jaroslav Hajek, 2008/10/30
- Re: MSVC compilation problem: std::abs<int64_t> does not exist, Abdelrazak Younes, 2008/10/30