Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to use floor function in groovy?

1009817Jun 16 2015 — edited Jun 16 2015

Hi,

We have a requirement to round the whole number value to the largest integer value that is equal to or less than a number.

Eg 3.6, 3.9, 3.2  Months should be displayed as 3

can anyone suggest how can it be achieved in groovy ?

i tried -

def num = 3.6

num = num.floor()

got error -

groovy.lang.MissingMethodException :

No signature of method: java.math.BigDecimal.floor() is applicable for argument types: () values: []

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 14 2015
Added on Jun 16 2015
5 comments
1,927 views