c# - Change float type precision -
I want to decrease the float type precision from 7 to 6. "I tried to multiply the number 10 but it did not work. Any ideas?
If you are just trying to format the number on the output (i.e. a string in the conversion), you just need to use a proper format string:
13.651234f.ToString ( "F6"); // always be the six decimal places
If you have to do this for your application logic, you might want to decimal
float
is used> - float
is a binary number, so the notion of "decimal" decimal space is a little far away.
Comments
Post a Comment