41 lines
1.1 KiB
Java
41 lines
1.1 KiB
Java
package d0.a0;
|
|
/* compiled from: MathJVM.kt */
|
|
public class a {
|
|
public static final int getSign(int i) {
|
|
if (i < 0) {
|
|
return -1;
|
|
}
|
|
return i > 0 ? 1 : 0;
|
|
}
|
|
|
|
public static final int roundToInt(double d) {
|
|
if (Double.isNaN(d)) {
|
|
throw new IllegalArgumentException("Cannot round NaN value.");
|
|
} else if (d > ((double) Integer.MAX_VALUE)) {
|
|
return Integer.MAX_VALUE;
|
|
} else {
|
|
if (d < ((double) Integer.MIN_VALUE)) {
|
|
return Integer.MIN_VALUE;
|
|
}
|
|
return (int) Math.round(d);
|
|
}
|
|
}
|
|
|
|
public static final int roundToInt(float f) {
|
|
if (!Float.isNaN(f)) {
|
|
return Math.round(f);
|
|
}
|
|
throw new IllegalArgumentException("Cannot round NaN value.");
|
|
}
|
|
|
|
public static final long roundToLong(double d) {
|
|
if (!Double.isNaN(d)) {
|
|
return Math.round(d);
|
|
}
|
|
throw new IllegalArgumentException("Cannot round NaN value.");
|
|
}
|
|
|
|
public static final long roundToLong(float f) {
|
|
return roundToLong((double) f);
|
|
}
|
|
}
|