diff options
author | Wesley Wolfe <weswolf@aol.com> | 2012-04-15 18:25:57 -0500 |
---|---|---|
committer | Wesley Wolfe <weswolf@aol.com> | 2012-04-15 18:25:57 -0500 |
commit | 1fd825cb7bcf2ffcd0dcd5c2ca074dc9ad13830c (patch) | |
tree | 2986996d89389718f7ffb73bb436c24e93530265 /src/main/java/org | |
parent | 55c12d5dd587aa60ed9e6baa76910336eac14bf1 (diff) | |
download | bukkit-1fd825cb7bcf2ffcd0dcd5c2ca074dc9ad13830c.tar bukkit-1fd825cb7bcf2ffcd0dcd5c2ca074dc9ad13830c.tar.gz bukkit-1fd825cb7bcf2ffcd0dcd5c2ca074dc9ad13830c.tar.lz bukkit-1fd825cb7bcf2ffcd0dcd5c2ca074dc9ad13830c.tar.xz bukkit-1fd825cb7bcf2ffcd0dcd5c2ca074dc9ad13830c.zip |
Adding ceil to NumberConversions
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); } |