6
6tc1
Hi all, I just discovered a rounding error that occurs in C#. I'm sure
this is an old issue, but it is new to me and resulted in a fair amount
of time trying to track down the issue.
Basically put the following code into your C# app:
float testFloat2 = (int) (4.2f * (float)100);
Console.Out.WriteLine("1: "+testFloat2);
and the result will be 419
If I use Convert.ToInt32 I can get around this problem - but it seems
that both should do the same thing, shouldn't they?
Novice
this is an old issue, but it is new to me and resulted in a fair amount
of time trying to track down the issue.
Basically put the following code into your C# app:
float testFloat2 = (int) (4.2f * (float)100);
Console.Out.WriteLine("1: "+testFloat2);
and the result will be 419
If I use Convert.ToInt32 I can get around this problem - but it seems
that both should do the same thing, shouldn't they?
Novice