Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. decimal integralValue = Math.Truncate(value);
  2.  
  3. decimal fraction = value - integralValue;
  4.  
  5. decimal factor = (decimal)Math.Pow(10, decimalPlaces);
  6.  
  7. decimal truncatedFraction = Math.Truncate(fraction * factor) / factor;
  8.  
  9. decimal result = integralValue + truncatedFraction;
  10.  
  11. return result;
  12.  
  13. Math.Round(valorDecimal, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement