How To Round Up Two Decimal Places

Hi,
I’ve been trying to use Math.Round, but noticed that whenever I do it two two decimal places it always rounds down, and whenever I attempted to use Math.Ceiling, it will always round to the nearest interger, I was wondering if there was any way to use either one of these two round up to the second decimal place?

grafik
And Also:
grafik
With too much conversions
grafik

Also have a look here:

Can you share some examples, where you are facing the issue?

@traeyoung

You can try this YourNumber.tostring(“0.00”)

Thanks!!!

2 Likes

This worked for me.

Regarding your Math.round

Try doing it with only 3 decimals

Maybe you are looking for the F3 - 3 decimals
Otherwise just open a new topic and get individual help from there

Don’t need any help. Just an observation I have made.

Math.Round will floor unless last decimal is >5.

So
Math.round(99.985,2) will give 99.98
Math.round(99.985,2, MidPointRounding.AwayFromZero) will give 99.99

If precision is a must, convert the value to decimal

Convert.ToDecimal(dou_var)