Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

How to truncate a decimal without rounding

var value = 1.23456M;
var shortenedValue = Convert.ToDecimal(value.ToString("0.###"));

Assert.Equals(shortenedValue, 1.234);
1234
Source by www.azureblue.io #
 
PREVIOUS NEXT
Tagged: #How #truncate #decimal #rounding
ADD COMMENT
Topic
Name
5+7 =