M
Mikael Svenson
Sample code:
static void Main(string[] args)
{
double inf = 0.1 / 0.0;
int test2 = (int)(inf * 0.0F);
Console.WriteLine( test2.ToString() );
}
On a P3 this gives the result "0", on a P4 it gives -2147483648 which is
int.MinValue.
Anyone know why this happens? Is it .Net which compiled wrongly on a P4,
or is it the P4 which is erroneus?
Of course if I compile with overflow checking it throws an exception,
and it's good practise to check the value before you divide with it. (I
made this example out from a graph component I downloaded which failed
on a P4.)
Regards,
Mikael Svenson
static void Main(string[] args)
{
double inf = 0.1 / 0.0;
int test2 = (int)(inf * 0.0F);
Console.WriteLine( test2.ToString() );
}
On a P3 this gives the result "0", on a P4 it gives -2147483648 which is
int.MinValue.
Anyone know why this happens? Is it .Net which compiled wrongly on a P4,
or is it the P4 which is erroneus?
Of course if I compile with overflow checking it throws an exception,
and it's good practise to check the value before you divide with it. (I
made this example out from a graph component I downloaded which failed
on a P4.)
Regards,
Mikael Svenson