diff options
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/bukkit/util/NumberConversions.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/util/NumberConversions.java b/src/main/java/org/bukkit/util/NumberConversions.java index e482ceeb..dba11afb 100644 --- a/src/main/java/org/bukkit/util/NumberConversions.java +++ b/src/main/java/org/bukkit/util/NumberConversions.java @@ -11,6 +11,11 @@ public final class NumberConversions { return floor == num ? floor : floor - (int) (Double.doubleToRawLongBits(num) >>> 63); } + public static int ceil(final double num) { + final int floor = (int) num; + return floor == num ? floor : floor + (int) (~Double.doubleToRawLongBits(num) >>> 63); + } + public static int round(double num) { return floor(num + 0.5d); } |