mercredi 2 septembre 2015

Improper conversion from float to int C #?

I can not understand why is done differently. Example below.

float val = 0.94f;
int i = (int) ( val * 100);

The result of 93?

float val = 0.94f;
float val1 = val * 100;
int i = (int) (val1);

The result of 94?




Aucun commentaire:

Enregistrer un commentaire