How to get just two number after decimal places

Hello friends. can anyone help me with the below problem.

8.888888 expected op 8.88

8.88 expected op 8.88

8.8 expected op 8.80

8 expected op 8.00

Thanks in advance.

1 Like

Assign Activity:
originalNumber = 8.33

Assign Activity:
roundedNumber = Math.Round(originalNumber, 2)

Duplicate Post :How to truncate value after 2 decimal place

@Gayathri_Mk
Please help with this

eg i have number=8.88888
Expected output=8.88

The above solution is rounding off the number it is giving 8.89 but i need 8.88

HI @aslam_ali1

try this it is working as your need.

Regards,
Gayathri M K

Hi @aslam_ali1

Try this

Input=8.8888
Math.Floor(Input * 100) / 100

Hope this helps!!

Refer this thread
I have shared a workflow sample as well

Cheers @aslam_ali1

We are some parts critical on String Acrobatics for number parsing. But as we can enhance the approach we can start with

grafik

HarmonizedNumber =

CDbl(System.Text.RegularExpressions.Regex.Match(YourInputString,"\d+(\.\d{1,2})?").Value).toString("F2")

Thank you @ppr it works awesome

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.