Logic simplification in iceil/ifloor.

This commit is contained in:
Michael Bayne
2012-05-11 08:30:12 -07:00
parent e8c11aba87
commit c99825d35f
+2 -2
View File
@@ -34,7 +34,7 @@ public class MathUtil
*/
public static int ifloor (float v) {
int iv = (int)v;
return (v < 0f) ? ((iv == v || iv == Integer.MIN_VALUE) ? iv : (iv - 1)) : iv;
return (v >= 0f || iv == v || iv == Integer.MIN_VALUE) ? iv : (iv - 1);
}
/**
@@ -43,7 +43,7 @@ public class MathUtil
*/
public static int iceil (float v) {
int iv = (int)v;
return (v > 0f) ? ((iv == v || iv == Integer.MAX_VALUE) ? iv : (iv + 1)) : iv;
return (v <= 0f || iv == v || iv == Integer.MAX_VALUE) ? iv : (iv + 1);
}
/**