S
sonic_soul
so my app uses float for money, and we are now consuming a webservice
that uses double for money. here is the problem i run into while
converting
float f1 = 23.32
double d1 = (double)f1;
d1=23.3199996948242
i understand that is because of the extra floating spaces (although it
still isnt making perfect sense to me, why wouldnt the extra floating
spaces just add 0's which would keep the number the same)
i suppose i could convert it to string and than parse double .. but
what is the best way to convert it keeping in mind currency with just
2 decimal places with best precision ?
that uses double for money. here is the problem i run into while
converting
float f1 = 23.32
double d1 = (double)f1;
d1=23.3199996948242
i understand that is because of the extra floating spaces (although it
still isnt making perfect sense to me, why wouldnt the extra floating
spaces just add 0's which would keep the number the same)
i suppose i could convert it to string and than parse double .. but
what is the best way to convert it keeping in mind currency with just
2 decimal places with best precision ?