开发者

Strange error when using "Double.NaN" and "double.MaxValue" in c#

I have a function in my code like (C#, NET 3.5, Visual Studio 2008):

public double function CalculateSomething()
{
   ...
   double a = double.NaN; // Or double.MaxValue, with same behaviour
   ...
}

This function is called by the main class, like this:

...
double res = o.CalculateSomething();
...

Although it looks like incredible (for me, it is) and ONLY on certain computers (only in 2 computers from 60) without anything special (WinXP SP3), if I use the "alias" (double.NaN or double.MaxValue) the program is broken without any kind of 开发者_开发问答error screen when the program calls "CalculateSomething", whereas if you assign a particular value, works perfectly.

I mean:

public double function CalculateSomething()
{
   ...
   double a = double.NaN; // FAAAAIL!!!!
   double b = -99999; // OK... 
   ...
}

Although the change I made, the program can run on all computers, i have curiosity. Does anyone know what may be happening?. Thank you.


Ok, i found the problem:

  • I installed NET 4.0, but the program needed NET 3.5. I installed NET 3.5 and it worked.

Really, that rarest thing, i have ever seen.

Thank you all for your responses.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜