cemal_aydin Posted October 27, 2021 Share Posted October 27, 2021 Hi,i want to round a value that is 3.35 to a value of 3.50 in the decimal rounding operation. With which function can I do this Link to comment Share on other sites More sharing options...
gustavofarias Posted October 27, 2021 Share Posted October 27, 2021 This is not rounding, it's another operation.Can't you do it in the expression of the text field or variables? Link to comment Share on other sites More sharing options...
bigalex Posted November 2, 2021 Share Posted November 2, 2021 $V{ RoundUp}.setScale(2,BigDecimal. ROUND_HALF_UP) Link to comment Share on other sites More sharing options...
gustavofarias Posted November 2, 2021 Share Posted November 2, 2021 The above answer is wrong and you produce the exact same 3.35 Link to comment Share on other sites More sharing options...
rmeadows Posted November 8, 2021 Share Posted November 8, 2021 try the above with BigDecimal.ROUND_CEILING or set the number of decimal places to 1 so that it rounds at that position. so$V{ RoundUp}.setScale(1,BigDecimal. ROUND_HALF_UP)Thanks. Link to comment Share on other sites More sharing options...
gustavofarias Posted November 8, 2021 Share Posted November 8, 2021 Won't produce correct answers.above with BigDecimal.ROUND_CEILING -> 3.35set the number of decimal places to 1 ($V{ RoundUp}.setScale(1,BigDecimal. ROUND_HALF_UP)) -> 3.4 What is asked is not a rounding operation, so using rounding is unlikely produce a correct answer. Link to comment Share on other sites More sharing options...
jgust Posted December 17, 2021 Share Posted December 17, 2021 I had this problem when I worked in the newspaper industry. We used a pagination program that would round up on the 10th of a point. The simple solution is to add the threshold difference to the number you are rounding up.If .35 is your minimum threshold then you can add .15 to the number (.5-.35=.15) giving the knowledge that .5 is the universal round-up number. 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