jeudi 19 juin 2014

Wrong Value after type casting in 32 bit process


Vote count:

0




Please see the following code in C#.



float a = 10.0f;
float b = 0.1f;

float c = a / b;
int indirect = (int)(c);
// Value of indirect is 100 always

int direct = (int)(a / b);
// Value of direct is 99 in 32 bit process (?)
// Value of direct is 100 in 64 bit process


Why do we get 99 in 32-bit processes?


I am using VS2013.



asked 42 secs ago






Aucun commentaire:

Enregistrer un commentaire