How To Truncate a Decimal To X Places



TODO:

Have you ever wanted to truncate a decimal to X places?

 

SOLUTION:

decimal rate = .07654;
decimal newRate = Math.Truncate(rate * 1000m) / 1000m;

 

NOTES:

The result will be .076



Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading