Use simple multiplication for squaring. Fixes BUKKIT-4836

This change adds a method to NumberConversions for squaring and
replaces uses of Math.pow(..., 2) with the new method for efficiency
reasons.

By: Wesley Wolfe <weswolf@aol.com>
This commit is contained in:
Bukkit/Spigot
2013-10-09 01:56:35 -05:00
parent 5b7e75839f
commit db05700052
3 changed files with 12 additions and 8 deletions
@@ -20,6 +20,10 @@ public final class NumberConversions {
return floor(num + 0.5d);
}
public static double square(double num) {
return num * num;
}
public static int toInt(Object object) {
if (object instanceof Number) {
return ((Number) object).intValue();