I want to convert any input float having any number of decimals, to string with only 2 decimals; if I do:
(13399.25f).ToString("#.00") returns "13399,25" -> OK
BUT,
(133995.25f).ToString("#.00") returns "133995,30" -> KO!
Also, I see that
(133995.25d).ToString("#.00") returns "133995,25" -> OK
Here, it says that float has a "precision" of 7 digits... the number 133995.25f has 8 digits ... So, is Precision the number of digits that a number has in total ? I thought it was the number of digits for the decimal part only...:
https://www.codingame.com/playgrounds/14640/c-professional---numbers/numeric-types-in-c
Also, the "scale" indicates that the number can be as high as ±3.4x1038 far far less than my number... Why is that ?
Also, this article confuses me even more: C# float.ToString Rounding Values
It suggests to use "G9" format, but if my input has a nr. of decimals different from 2, I would not get an output string with 2 decimals...
Thanks !