[Mono-list] MS doc discrepencies

Derek Holden dsh2120@draper.com
Wed, 27 Feb 2002 12:38:39 -0500


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

At 2/27/2002 02:49 PM, Jon Guymon wrote:
>The class I'm testing is System.Math.
>
>Here are the question areas:
>operation                               docs                            result
>Log(0)                          PositiveInfinity 
>NegativeInfinity
>Log(0, 
>y)                               PositiveInfinity 
>NegativeInfinity
>Log10(0)                                PositiveInfinity 
>NegativeInfinity
>Pow(x, NegativeInfinity)        0                               NaN
>Pow(x, PositiveInfinity)        PositiveInfinity                NaN
>
>that's it I think
>
>I am admittedly /not/ a math buff, but I think I did everything correctly.
>In any event I have attached the code for checking and cross-posting and
>stuff.  The trouble spots are commented.
>
>Oh, by the way, where can I get my hands on IEEE specs for these operations?
>
>thanks,
>jon
>
>-----Original Message-----
>From: Ben Houston [mailto:ben@exocortex.org]
>Sent: Tuesday, February 26, 2002 8:40 PM
>To: 'Jon Guymon'
>Subject: RE: [Mono-list] MS doc discrepencies
>
>
>Hi Jon,
>
>Just out of curiosity what behavior differs between the docs and the
>actual classes?   I'm a bit of a math buff and am currently writing a
>DSP library in C# thus I'm interested. :-)
>
>And if it helps I would suggest going with the behavior that is most
>adherent to numerical methods standards (i.e IEEE, etc...).
>
>Take care,
>-ben houston
>http://www.exocortex.org/~ben
>
>
>
> > -----Original Message-----
> > From: mono-list-admin@ximian.com [mailto:mono-list-admin@ximian.com]
>On
> > Behalf Of Jon Guymon
> > Sent: Wednesday, February 27, 2002 1:26 AM
> > To: mono-list@ximian.com
> > Subject: [Mono-list] MS doc discrepencies
> >
> > Hello,
> >
> > I've been working on MonoTests.System.MathTest, running it with the
> > Microsoft runtime, and testing the Microsoft classes.  What I found is
> > that
> > in a couple of cases the Microsoft System.Math class does not behave
>as
> > the
> > documentation describes it.
> >
> > This makes me wonder which I should treat as law.  Should I write the
> > tests
> > to they follow the docs to the letter, or should I write them so they
>all
> > pass when run against the Microsoft classes?
> >
> > It seems to me that the docs should be trusted over the
>implementation,
> > but
> > I want to check before I submit something.
> >
> > It's also possible I'm doing something wrong.  I'll send my code to
> > whoever
> > wants to proof it, but I don't want to clutter the mailing list just
>yet
> > ^_^.
> >
> > Also, assuming this all gets worked out, should I simply post the code
>to
> > this list?
> >
> > Thanks
> > Jon
> >
> >
> >
> > _______________________________________________
> > Mono-list maillist  -  Mono-list@ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list