octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Comparison with NaN


From: Michael Goffioul
Subject: Re: Comparison with NaN
Date: Mon, 11 May 2009 21:39:26 +0100

I tracked down the problem in the debugger and could determine that
the version of sort_isnan<double> linked into octave is not the specialized
one, but the generic one (which returns false). Inspecting the objects files,
I could find an instantiation of sort_isnan<double> in Array-C.o, Array-ch.o,
Array-b.o, Array-d.o, Array-f.o and Array-fC.o. At link stage, I think
the linker
is just picking the first one appearing, that is the one from Array-C.o (hence
not the specialized one). I see in Array-d.cc that sort_isnan<double> should
be inlined, but I compile with debug enabled and I think MSVC does not do
any inlining in debug mode.

What I could check is that:
1) when re-ordering the objects file such that Array-d.o is picked first, the
specialized version of sort_isnan is linked in
2) when using 'extern template bool sort_isnan<double>(double);' in all
Array-xx.c (except Array-d.cc), no instantiation of sort_isnan<double>
occurs in the corresponding object files, and the specialized version
(the only one remaining) is compiled in

Now, why MSVC does instantiate sort_isnan<double> in other files than
Array-d.cc? I'm not sure, but when inspecting a pre-processed Array-C.cc,
I see usage of Array<double> in idx-vector.h; this might trigger instantiation
of Array<double> class, leading to instantiation of sort_isnan<double>.
But this is just a wikd guess...

Michael.


On Mon, May 11, 2009 at 6:51 PM, Michael Goffioul
<address@hidden> wrote:
> On Mon, May 11, 2009 at 10:06 AM, Jaroslav Hajek <address@hidden> wrote:
>> here you are:
>>
>> sort ([NaN, 1, -1, 2, Inf]')
>
> ans =
>
>   NaN
>    -1
>     1
>     2
>   Inf
>
>> sort ([NaN, 1, -1, 2, Inf], 2)
>
> ans =
>
>   NaN    -1     1     2   Inf
>
>
>> sortrows ([NaN, 1, -1, 2, Inf]')
>
> ans =
>
>   NaN
>    -1
>     1
>     2
>   Inf
>
>
> Michael.
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]