2 @METHODDEFAULT("OUT<IN,OUT<THIS,,IN*,THISLOC=THIS,RETURNLOC=OUT")
5 static final double PI = 3.14159265358979323846;
7 // an alias for setPI()
8 public static double PI() {
9 double PI = 3.14159265358979323846;
13 public static int abs(@LOC("IN") int x) {
14 return (x < 0) ? -x : x;
17 public static long abs(long x) {
18 return (x < 0) ? -x : x;
21 public static double abs(double x) {
22 return (x < 0) ? -x : x;
25 public static float abs(@LOC("IN") float x) {
26 return (x < 0) ? -x : x;
29 public static double max(double a, double b) {
30 return (a > b) ? a : b;
33 public static float max(@LOC("IN") float a, @LOC("IN") float b) {
34 return (a > b) ? a : b;
37 public static int max(@LOC("IN") int a, @LOC("IN") int b) {
38 return (a > b) ? a : b;
41 public static long max(long a, long b) {
42 return (a > b) ? a : b;
46 public static double min(@LOC("IN") double a, @LOC("IN") double b) {
47 return (a < b) ? a : b;
51 public static float min(@LOC("IN") float a, @LOC("IN") float b) {
52 return (a < b) ? a : b;
56 public static int min(@LOC("IN") int a, @LOC("IN") int b) {
57 return (a < b) ? a : b;
61 public static long min(@LOC("IN") long a, @LOC("IN") long b) {
62 return (a < b) ? a : b;
65 /** sqrt(a^2 + b^2) without under/overflow. **/
66 public static double hypot(double a, double b) {
68 if (abs(a) > abs(b)) {
70 r = abs(a) * sqrt(1 + r * r);
73 r = abs(b) * sqrt(1 + r * r);
80 public static int round(@LOC("IN") float a) {
81 // this check for NaN, from JLS 15.21.1, saves a method call
82 return (int) floor(a + 0.5f);
85 public static double rint(double x) {
89 if (((int) y) % 2 == 0) {
100 public static native double sin(double a);
102 public static native double cos(double a);
104 public static native double asin(double a);
106 public static native double acos(double a);
108 public static native double tan(double a);
110 public static native double atan(double a);
112 public static native double atan2(double a, double b);
114 public static native double exp(double a);
116 public static native double sqrt(double a);
118 public static native double log(double a);
121 public static native double pow(@LOC("IN") double a, @LOC("IN") double b);
123 public static native double ceil(double a);
125 public static native double floor(double a);
127 public static native float sinf(float a);
129 public static native float cosf(float a);
131 public static native float expf(float a);
133 public static native float sqrtf(float a);
135 public static native float logf(float a);
137 public static native float powf(float a, float b);
139 public static native float ceilf(float a);
141 public static native float IEEEremainder(float f1, float f2);