[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Comparison with NaN
From: |
Jaroslav Hajek |
Subject: |
Re: Comparison with NaN |
Date: |
Thu, 14 May 2009 10:33:30 +0200 |
On Mon, May 11, 2009 at 11:23 PM, Michael Goffioul
<address@hidden> wrote:
> I could further track down the Array<double> instantiation to the
> fact that Array-C.cc ends up including dMatrix.h. This header
> defines a Array<double>-inherited class with dllexport, which
> makes MSVC to instantiate Array<double>.
>
OK, that makes sense.
> The strange thing is the sequence of inclusion that leads to dMatrix.h:
> ArrayN.cc
> ArrayN-idx.h
> Range.h
> dMatrix.h
>
> However, inspecting ArrayN-idx.h, everything is commented out,
> except 3 include statements. I'm not sure what's the purpose of
> that file, but commenting everything solved my problem.
Glad you tracked the problem. I think the whole file can be removed;
it seems to be a leftover. I'll do it when I return from my business
trip.
Though avoiding implicit Array instantiations is indeed a good policy,
I don't like the system being so fragile; such an issue seems likely
to be repeated unless we take some countermeasures. One possibility is
to use xisnan rather than sort_isnan, and introduce a default template
for it in lo-mappers.h. Another option is to provide at least the
basic sort_isnan specializations/overloads (double, float, Complex,
FloatComplex) directly in Array.cc, to combat the effect you
discovered. The problem could still arise with third-party Array
instantiations, but I think the danger would be much smaller.
>
> Now I'm left with 5 test failures, one of which I don't know what to
> think about (I'm not even sure this is a problem...):
>
> ***** test
> [v, i] = sort ([NaN, 1i, -1, Inf, 1, 1i]);
> assert (v, [1, 1i, 1i, -1, Inf, NaN])
> assert (i, [5, 2, 6, 3, 4, 1])
> !!!!! test failed
> assert (i,[5, 2, 6, 3, 4, 1]) expected
> 5 2 6 3 4 1
> but got
> 5 6 2 3 4 1
>
>
It is indeed a problem, because the sort is supposed to be stable.
Unfortunately, I can't reproduce it.
can you run the infringing "sort" statement and verify that v(2) == v(6)?
what does
[v,i] = sort([NaN, 2, 3, Inf, 1, 2])
return?
cheers
--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
- Re: Comparison with NaN, (continued)
- Re: Comparison with NaN, Jaroslav Hajek, 2009/05/11
- Re: Comparison with NaN, Michael Goffioul, 2009/05/11
- Re: Comparison with NaN, Jaroslav Hajek, 2009/05/11
- Re: Comparison with NaN, Michael Goffioul, 2009/05/11
- Re: Comparison with NaN, Jaroslav Hajek, 2009/05/11
- Re: Comparison with NaN, Michael Goffioul, 2009/05/11
- Re: Comparison with NaN, Jaroslav Hajek, 2009/05/11
- Re: Comparison with NaN, Michael Goffioul, 2009/05/11
- Re: Comparison with NaN, Michael Goffioul, 2009/05/11
- Re: Comparison with NaN, Michael Goffioul, 2009/05/11
- Re: Comparison with NaN,
Jaroslav Hajek <=
- Re: Comparison with NaN, Michael Goffioul, 2009/05/14
- Re: Comparison with NaN, Jaroslav Hajek, 2009/05/14
- Re: Comparison with NaN, Michael Goffioul, 2009/05/14
- Re: Comparison with NaN, Jaroslav Hajek, 2009/05/15
- Re: Comparison with NaN, Michael Goffioul, 2009/05/15
- Re: Comparison with NaN, Jaroslav Hajek, 2009/05/17
- Re: Comparison with NaN, Michael Goffioul, 2009/05/17
- Re: Comparison with NaN, Jaroslav Hajek, 2009/05/17
- Re: Comparison with NaN, Michael Goffioul, 2009/05/17
- Re: Comparison with NaN, Jaroslav Hajek, 2009/05/17