trim to 5 decimal places

 

I'm using NormalizeDouble() to round a number to the 5th decimal place but the problem is that it keeps all the zeroes at the end. For example: 1.2345600000.


How can I trim the number to 5 decimal places, getting rid of the zeroes?

 
string DoubleToStr( double value, int digits)
  string value=DoubleToStr(1.28473418, 5);
  // the value is "1.28473"
 
Any solution there? the above is not solution, it is conversion into STRING!!!
 

It is a solution.

Don't confuse what the number actually is with how you want the number displayed.

There is no difference between 1.2345600000 and 1.23456 except how it is displayed.

Now we are teetering on the edge of 2 forum bugbears - NormalizeDouble and how floating point numbers are stored in binary 

Reason: