class MainClass
{
static void Main()
{
decimal decimalNumber = 4.1231232M;
double doubleNumber1 = 0.1F * 42F;
double doubleNumber2 = 0.1D * 42D;
float floatNumber = 0.1F * 42F;
System.Console.WriteLine("{0} != {1}", decimalNumber, (decimal)doubleNumber1);
System.Console.WriteLine("{0} != {1}", (double)decimalNumber, doubleNumber1);
System.Console.WriteLine("(float){0}M != {1}F",(float)decimalNumber, floatNumber);
System.Console.WriteLine("{0} != {1}", doubleNumber1, (double)floatNumber);
System.Console.WriteLine("{0} != {1}", doubleNumber1, doubleNumber2);
System.Console.WriteLine("{0}F != {1}D", floatNumber, doubleNumber2);
System.Console.WriteLine("{0} != {1}", (double)4.2F, 4.2D);
System.Console.WriteLine("{0}F != {1}D", 4.2F, 4.2D);
}
}
|