octave-maintainers
[Top][All Lists]
Advanced

[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: Mon, 11 May 2009 07:35:17 +0200

On Sun, May 10, 2009 at 10:43 PM, Michael Goffioul
<address@hidden> wrote:
> Hi,
>
> After running the test suite, I get a couple of errors. All of these
> seem to be related to comparing/sorting with NaN. For instance:
>
> assert (sort ([NaN, 1, -1, 2, Inf], 2),[-1, 1, 2, Inf, NaN]) expected
>    -1     1     2   Inf   NaN
> but got
>   NaN    -1     1     2   Inf
>
> Can anybody tell me what is the expected behavior?
>

The assertion result indicates the expected behavior. I can't
reproduce the problem. Hmmm. Can you try the attached test patch and
tell me whether the message gets printed after running `sort ([NaN, 1,
-1, 2, Inf], 2)' ? (it will be only printed once, so if you have some
startup scripts calling sort with doubles, it should get printed
earlier).

Plus, please tell me the status of HAVE_CMATH_ISNAN in your config.h.

cheers

-- 
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz

diff --git a/liboctave/Array-d.cc b/liboctave/Array-d.cc
--- a/liboctave/Array-d.cc
+++ b/liboctave/Array-d.cc
@@ -40,6 +40,12 @@
 inline bool
 sort_isnan<double> (double x)
 {
+  static bool first_time = true;
+  if (first_time)
+    {
+      std::cerr << "sort_isnan<double> correctly specialized.\n";
+      first_time = false;
+    }
   return xisnan (x);
 }



reply via email to

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