Double dblValue = 0.0001;
Boolean a = (dblValue >= (1/1000));
Boolean b = (dblValue >= 0.001);
Console.WriteLine("dblValue >= (1/1000) is " + a);
Console.WriteLine("dblValue >= 0.001 is " + b);
Console.ReadLine();
上述C#代码将'a'评估为true,将'b'评估为false。在VB.NET中,等效代码将'a'评估为false,将'b'评估为false。为什么'a'评估为真?C#2.0双重处理 - 奇怪行为
是否存在隐式转换我在这里丢失 - 为什么它不影响VB.NET(严格)?
或者在两个参数中附加一个'd'来明确地使它成为双精度。 – Joey 2010-07-27 13:52:23
闪亮。谢谢 :) – Rushyo 2010-07-27 14:19:37