In Groovy we can make a number absolute with the abs() method. This method is added to the Number class by Groovy.
abs()
Number
assert 42 == (-42).abs() assert 43.21 == (-43.21).abs()