-
Notifications
You must be signed in to change notification settings - Fork 0
NumberUtils
Dan M edited this page Mar 28, 2022
·
2 revisions
The NumberUtils class contains function for generic number manipulation, from rounding to n places or wrapping between two values.
Takes in val and will return it rounded to the nearest places decimal points. For example:
double num = 54.423;
num = NumberUtils.roundToPlaces(num, 1);
num is now equal to 54.4.
Wraps val between min and max. For example:
for (double i = 0; i < 10; i++) {
print(NumberUtils.wrapDouble(i, 2.0, 5.0));
}The output of this will be:
4.0
5.0
2.0
3.0
4.0
5.0
2.0
3.0
4.0
5.0
Exactly the same as static double wrapDouble(double val, double min, double max),
but works with integers instead.
Models - Currently Empty