While i study C#, i casted a double into a float by explicit conversion
<code>int myInt2;
double myDouble3 = 13.1122217232323;
myInt2 = (int)mydouble3;
</code>
<code>int myInt2;
double myDouble3 = 13.1122217232323;
myInt2 = (int)mydouble3;
</code>
int myInt2;
double myDouble3 = 13.1122217232323;
myInt2 = (int)mydouble3;
when it comes to the result, as myDouble3
changes the converted float differ.
It sometimes is rounded up and sometimes is rounded down. Why does it happen? Is there andy specific mechanism in explicit conversion double to float?
<code>if the double is -13.135353535123514,
then the converted float goes -13.135353 // rounded down
if the double is 13.2323232323232323,
then the converted float goes 13.232324 // rounded up
</code>
<code>if the double is -13.135353535123514,
then the converted float goes -13.135353 // rounded down
if the double is 13.2323232323232323,
then the converted float goes 13.232324 // rounded up
</code>
if the double is -13.135353535123514,
then the converted float goes -13.135353 // rounded down
if the double is 13.2323232323232323,
then the converted float goes 13.232324 // rounded up
3