rlong98

10 years agoContributor

Solved

# How to round a decimal value when working with context.expand number values?

I'm to verify values of an equation that is happening on the back end.

Example Values:

wages = 29250

divby = 11670

Should Equal = 2.5064267352 //which it does

**QUESTION: I need the result value I"m asserting is to = 2.51**

def testValuea = context.expand( '${Properties#a}' ) as int //--11670

def testValueb = context.expand( '${Properties#b}' ) as int //--29250

result = (testValueb / testValuea)*100

//now my value is 250.64267352

**QUESTION: How do I get this to round to (3)?**

Not sure where to use .Round(3) or if to use something else.

Thank you,

Rob

Thanks Rupert

I did find this:

(<math equation>).toDouble().round(3)

Still a rookie in the scripting work - not understanding the "Double" term.

Thanks again...

Rob