This is due to the use of decimal or double number.
While inside (as shown in the Source Code ) Math.Round() saves trailing zeros even in double, nevertheless, the fact that it is stored as double zeros in memory forces all trailing zeros to be automatically deleted.
So, if you need trailing zeros, you can use the string display functions to format them as others have answered, or remember to pass the original value as a decimal number (causing use inside Decimal.Math.Round , which will only handle decimal places ), and do not leave the result double, and also do not save it in a double variable.
Similarly, if you have a decimal number and you do not need trailing zeros, just add it to double (you can either enter the input in Math.Round or the result, it does not matter if somewhere in the path becomes double).
yoel halb
source share