Boost logo

Boost Users :

Subject: Re: [Boost-users] isnan stopped working
From: Thijs Koerselman (thijskoerselman_at_[hidden])
Date: 2009-01-05 15:23:13


On Mon, Jan 5, 2009 at 11:05 AM, Bernhard Walle <bernhard.walle_at_[hidden]>wrote:

> >
> > float nan = FP_NAN;
>
> That's just 3.
>
> Use std::numeric_limits<float>::quiet_NaN() from <limits>. See the
> example below that works for me on Linux with Boost 1.36 and g++ 4.3.2.

Aha! thanks. I was wondering why it was an enum :) (it's 1 on my platform).

> > int ret = 0xdeadbeef;
> > ret = (boost::math::isnan)(nan);
> >
> > isnan never returns anything.
>
> Well, in my tests on Linux that is set to 0 in your example.
>

Sorry it DOES work. When i step over the last assignment to the end of the
function block, XCode doesn't update the value of ret in the debugging
window. It still displays 0xdeadbeaf, even though the value has changed. So
it did return a value. I wonder if this is intended. I can't think of a good
reason why XCode it would work like that.

So the enum was the original reason for my code not working. The only thing
I'm still wondering about is why it did work before, when I was using the
enum with the earlier version. It's a completely different value for NaN. It
doesn't matter anymore, now everything is sorted.

Thanks everyone for helping out.

Cheers,
Thijs



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net