Fast way to remove trailing zeros before formatting:
decimal valueWithoutZeros = d / 1.000000000000000000000000000000000m; string s = valueWithoutZeros.ToString();
https://stackoverflow.com/a/7983330