You can hardcode format string like this
num.ToString("###,###,###.####");
this will output with respect tu Current thread culture info. If you have european culture you will get "." as thousands separator. And this will output up to 4 decimals that are not equal 0. You can increase number of decimals and number of groups if you have larger numbers or need greater precison. But, not sure if there is a more elegant way...