TestProject Forum

Codless solution to round numbers

Hi,

Is there any feature on TestProject where I can round up numbers, decrease decimals?

I want to match the output parameter of my mathematical expression to what the website is returning.

@efilipe, you can use “Mathematical Utilities” addon.


2, after {number}, defines rounding precision.

But, if last number is <= 5, your result will be rounded down.

For example: round(17.745,2), will get you 17.74, as result. There is way set rounding mode in EvalEx. But, I don’t know, how to define this in recorder.

 // Increasing the precision and setting a different rounding mode.
 result = new Expression("2.4/PI")
         .setPrecision(128)
         .setRoundingMode(RoundingMode.UP)
         .eval(); // 0.763943726841...