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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user