[Mono-list] About the comparison of double values
yoros@wanadoo.es
yoros@wanadoo.es
Sat, 1 Feb 2003 18:41:09 +0100
--GvXjxJ+pjyke8COw
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
Hi again,
I have a testcase for a bug in the double comparison. When comparing any
double value with NaN it must be false but in a few cases it says true.
Can anyone guide me to find the place where is implemented the double
comparisons ? Thank you.
See you,
Pedro
--
Pedro Martinez Juliá
\ yoros@terra.es
)| yoros@wanadoo.es
/ http://yoros.cjb.net
Socio HispaLinux #311
Usuario Linux #275438 - http://counter.li.org
GnuPG public information: pub 1024D/74F1D3AC
Key fingerprint = 8431 7B47 D2B4 5A46 5F8E 534F 588B E285 74F1 D3AC
--GvXjxJ+pjyke8COw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="double_nan_testcase.cs"
using System;
public class EntryPoint {
public static void Main (string[] args) {
double a = Double.NaN;
double b = 1.0;
if (a == a)
Console.WriteLine("NAN == NAN");
if (a < a)
Console.WriteLine("NAN < NAN");
if (a > a)
Console.WriteLine("NAN > NAN");
if (a <= a)
Console.WriteLine("NAN <= NAN");
if (a >= a)
Console.WriteLine("NAN >= NAN");
if (a == b)
Console.WriteLine("NAN == 1.0");
if (a < b)
Console.WriteLine("NAN < 1.0");
if (a > b)
Console.WriteLine("NAN > 1.0");
if (a <= b)
Console.WriteLine("NAN <= 1.0");
if (a >= b)
Console.WriteLine("NAN >= 1.0");
if (b == a)
Console.WriteLine("1.0 == NAN");
if (b < a)
Console.WriteLine("1.0 < NAN");
if (b > a)
Console.WriteLine("1.0 > NAN");
if (b <= a)
Console.WriteLine("1.0 <= NAN");
if (b >= a)
Console.WriteLine("1.0 >= NAN");
}
}
--GvXjxJ+pjyke8COw--