blabla_1983 Posted July 22, 2011 Share Posted July 22, 2011 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 More sharing options...
blabla_1983 Posted July 22, 2011 Author Share Posted July 22, 2011 Sorry for the post. I figured out how to do it. While it does not place zeros until it fills up the three slots, it does manage to round it.(Math.round($V{variable_name}*1000.0))/1000.0 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now