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 09:11:23 +0100

On Mon, May 11, 2009 at 6:35 AM, Jaroslav Hajek <address@hidden> wrote:
> 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.

Of course. My question was badly formulated, my fault.
I meant what is the standard C++ NaN comparison bevahior,
that I could test in a simple test program.

> 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).

I'll test that ASAP (probably this evening).

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

It's not defined. MSVC uses _isnan instead, so I assume that
std::_isnan would exist, though I didn't test yet.
(altough http://msdn.microsoft.com/en-us/library/7wsh95e5.aspx seems to
indicate that cmath does not define isnan).

Michael.



reply via email to

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