0

I mean if I set to 6

if I have 123, I would get 123.000
if I have 123.45, I would get 123.450
if I have 123456 I would 123456
if I have 1234567 I would get 1234567

In Math there is a name for this though I don't remember.

I can't see it here ? http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx

My question is for C# NOT JAVA and about using STANDARD in this language if it exists not custom algorithm since some people thumbed down : they seem to reinvent the wheel.

user310291
  • 36,946
  • 82
  • 271
  • 487
  • Hi why thumb down ? This is classical math. – user310291 May 20 '13 at 12:49
  • 1
    Duplicate http://stackoverflow.com/questions/4738853/java-decimal-format-parse-to-return-double-value-with-specified-number-of-deci – Akshay Joy May 20 '13 at 12:50
  • 2
    My question is for C# NOT JAVA and about using STANDARD in this language if it exists not custom algorithm – user310291 May 20 '13 at 12:50
  • Are you sure 1234567 would be represented as 1234567? Wouldn't it be 1234570 or 1234560, to be consistent? – mbeckish May 20 '13 at 12:51
  • No since I don't want to truncate the result of a calculation just get significative numbers. – user310291 May 20 '13 at 12:52
  • 2
    @user310291 - If you are limiting yourself to 6 significant digits when some digits are to the right of the decimal point, why are you allowing 7 significant digits when they are all to the left of the decimal point? – mbeckish May 20 '13 at 12:56

1 Answers1

2

The "#" Custom Specifier

Or just do it manually

Hope it helps, but I still dont get if you just want always 3 decimals or what?

Community
  • 1
  • 1
AAlferez
  • 1,480
  • 1
  • 22
  • 48