How do I round a number in Groovy? May 24, 2023 by Tarik If you’re dealing with doubles or floats You can simply use assert xyz == 1.789 xyz.round(1) == 1.8 xyz.round(2) == 1.79