Linked Questions
11 questions linked to/from Truncate Decimal number not Round Off
865 votes
19 answers
1.7m views
How do I display a decimal value to 2 decimal places?
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 ...
2 votes
4 answers
2k views
How to trim decimal? [duplicate]
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 ?
-1 votes
2 answers
260 views
Decimal digit truncating C# [duplicate]
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 = ...
158 votes
25 answers
278k views
Truncate Two decimal places without rounding
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....
37 votes
6 answers
106k views
String format for only one decimal place?
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 ...
11 votes
5 answers
35k views
Have decimal amount, want to trim to 2 decimal places if present
Have decimal amount, want to trim to 2 decimal places if present
4 votes
6 answers
34k views
Prevent Math.Round(95.55555555,2) from rounding to 95.56 in VB.NET
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 ...
1 vote
6 answers
1k views
how to take 6 numbers after the dot - but without round the number?
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
-1 votes
1 answer
487 views
Trimming a Float up to a certain decimal point [duplicate]
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. ...
-2 votes
1 answer
66 views
how to chop numbers in vb.net windows app?
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
0 votes
0 answers
41 views
Decimal truncating issue [duplicate]
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. ...