Linked Questions

865 votes
19 answers
1.7m views

When displaying the value of a decimal currently with .ToString(), it's accurate to like 15 decimal places, and since I'm using it to represent dollars and cents, I only want the output to be 2 ...
wows's user avatar
  • 11.2k
2 votes
4 answers
2k views

I have a decimal number : decimal a = 0.8537056986486486486486486486; I want to show it as string with only 8 digit after point : a equals -> "0.85370569". How can I do it ?
Haddar Macdasi's user avatar
-1 votes
2 answers
260 views

I have a decimal variable with following values a = 99.9999 b = 88.423766 c = 11.896589 Here I am trying to convert with 4 decimal points. And I used a = Math.Round(Convert.ToDecimal(a), 4); b = ...
TBA's user avatar
  • 1,195
158 votes
25 answers
278k views

Lets say I have a value of 3.4679 and want 3.46, how can I truncate that to two decimal places without rounding up? I have tried the following but all three give me 3.47: void Main() { Console....
user avatar
37 votes
6 answers
106k views

I'd like to dispaly only one decimal place. I've tried the following: string thevalue = "6.33"; thevalue = string.Format("{0:0.#}", thevalue); result: 6.33. But should be 6.3? Even 0.0 does not ...
4thSpace's user avatar
  • 44.4k
11 votes
5 answers
35k views

Have decimal amount, want to trim to 2 decimal places if present
Blankman's user avatar
  • 269k
4 votes
6 answers
34k views

If I do Math.Round(95.55555555,2) in VB.NET, the result is 95.56, but I want it the result the be 95.55. Is there a way to do this in VB.NET? I guess I just want to keep the decimal places, but not ...
Xaisoft's user avatar
  • 46.9k
1 vote
6 answers
1k views

how to take 6 numbers after the dot - but without round the number ? for example: 102.123456789 => 102.123456 9.99887766 => 9.998877 in C# winforms thak's in advance
Gold's user avatar
  • 62.9k
-1 votes
1 answer
487 views

I need a way to round down a float up to a specific number of decimal places. Math.Round will round up if the number after the cut is larger than 6, and Math.Floor does not work with decimal places. ...
TheGateKeeper's user avatar
-2 votes
1 answer
66 views

I want my program to enter a decimal that will output in 4 decimal places by not rounding the inputed number input: 0.6363636364 output: 0.6363
hotchongas's user avatar
0 votes
0 answers
41 views

This is my issue. Math.Truncate(-18141235.58 * 100.0) / 100.0 o/p: -18141235.57 .01 difference is coming. I have tried solutions as on (Truncate Decimal number not Round Off) but doesnt work. ...
Shreyash's user avatar