Jump to content
We've recently updated our Privacy Statement, available here ×

Rounding $variable to three decimals


blabla_1983

Recommended Posts

 Hi,

I'm using a variable to calculate the average of a bunch of Longs. The variable class is java.lang.Long.  It prints out the average correctly except for 1 small issue. 

Some of the numbers are too short (12.9) while others are too long(45.666666666667). I tried to edit the expression of the Text Field so that it would round to three decimals but it only seems to print  no decimals (39 or 45, not 39.xxx or 45.xxx).

All I want to do is round every printed value to three decimal places. If there is no value then it fills it in with a 0.

 

My expression that I tried using is: 

Code:
Math.round((double)(new BigDecimal((double)$V{snr_average}).multiply(1000.0)).divide(1000.0))
Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...