Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- decimal integralValue = Math.Truncate(value);
- decimal fraction = value - integralValue;
- decimal factor = (decimal)Math.Pow(10, decimalPlaces);
- decimal truncatedFraction = Math.Truncate(fraction * factor) / factor;
- decimal result = integralValue + truncatedFraction;
- return result;
- Math.Round(valorDecimal, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement