Saturday 15 January 2011

c# - Change float type precision -



c# - Change float type precision -

i want cut down float type precision 7 digits 6 after "." tried multiplying number 10 didn't work. ideas?

if you're trying format number on output (ie. in conversion string), need utilize proper format string:

13.651234f.tostring("f6"); // 6 decimal places

if need application logic, want utilize decimal rather float - float binary number, notion of "decimal" decimal places bit off.

c#

No comments:

Post a Comment