[Mono-list] MS doc discrepencies

gnarg@slackworks.com gnarg@slackworks.com
Wed, 27 Feb 2002 17:20:10 -0500 (EST)


I do use double.IsNaN()
I have not used double.IsInfinity(), but a straight == has proved
effective for testing double.PositiveInfinity and double.NegativeInfinity

There are several cases that are supposed to result in NaN or Infinity,
and I did test those correctly.  There are just a couple places where the
tests work, but return values differ from the docs.

As far as my gut reaction to whether the docs or the runtime are correct,
I lean towards the runtime, but I not mathematically inclined enough to
know for sure.  I'll check that IEEE link that someone posted (thanks for
that).

Has anyone looked at the code yet?  Does it look sound?

jon

On Wed, 27 Feb 2002, Derek Holden wrote:

> Jon,
>
> In your test are you testing for equality between the result and the
> NaN's/Infinity's? Your problem may lie in the test, since by definition you
> can't test a number directly against the actual NaN/Infinity member
> variables, you have to use the IsInfinity() and IsNaN() methods.
>
> double d = Double.NaN;
> if (d == Double.NaN)  // this will always be false, need to use
> Double.IsNaN (d)
>
> Derek