2007-07-29 23:32:23 +00:00
|
|
|
package java.lang;
|
|
|
|
|
|
|
|
public final class Math {
|
|
|
|
private Math() { }
|
|
|
|
|
|
|
|
public static int abs(int v) {
|
|
|
|
return (v < 0 ? -v : v);
|
2007-07-29 23:38:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static long abs(long v) {
|
|
|
|
return (v < 0 ? -v : v);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static float abs(float v) {
|
|
|
|
return (v < 0 ? -v : v);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static double abs(double v) {
|
|
|
|
return (v < 0 ? -v : v);
|
2007-07-29 23:32:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static long round(double v) {
|
|
|
|
return (long) (v + 0.5);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static int round(float v) {
|
|
|
|
return (int) (v + 0.5);
|
|
|
|
}
|
|
|
|
|
2007-07-30 23:19:05 +00:00
|
|
|
public static native double floor(double v);
|
2007-07-29 23:32:23 +00:00
|
|
|
|
2007-07-30 23:19:05 +00:00
|
|
|
public static native double ceil(double v);
|
2007-07-29 23:32:23 +00:00
|
|
|
|
2007-07-30 23:19:05 +00:00
|
|
|
public static native double exp(double v);
|
2007-07-29 23:32:23 +00:00
|
|
|
|
2007-07-30 23:19:05 +00:00
|
|
|
public static native double log(double v);
|
2007-07-29 23:32:23 +00:00
|
|
|
|
2007-07-30 23:19:05 +00:00
|
|
|
public static native double cos(double v);
|
2007-07-29 23:32:23 +00:00
|
|
|
|
2007-07-30 23:19:05 +00:00
|
|
|
public static native double sin(double v);
|
2007-07-29 23:32:23 +00:00
|
|
|
|
2007-07-30 23:19:05 +00:00
|
|
|
public static native double tan(double v);
|
2007-07-29 23:32:23 +00:00
|
|
|
|
2007-07-30 23:19:05 +00:00
|
|
|
public static native double acos(double v);
|
2007-07-29 23:32:23 +00:00
|
|
|
|
2007-07-30 23:19:05 +00:00
|
|
|
public static native double asin(double v);
|
2007-07-29 23:32:23 +00:00
|
|
|
|
2007-07-30 23:19:05 +00:00
|
|
|
public static native double atan(double v);
|
2007-07-29 23:32:23 +00:00
|
|
|
|
2007-07-30 23:19:05 +00:00
|
|
|
public static native double sqrt(double v);
|
2007-07-29 23:32:23 +00:00
|
|
|
|
2007-07-30 23:19:05 +00:00
|
|
|
public static native double pow(double v, double e);
|
2007-07-29 23:32:23 +00:00
|
|
|
}
|