1 |
/* Math.c - java.lang.Math native functions |
/* Math.c - java.lang.Math native functions |
2 |
Copyright (C) 1998, 1999 Free Software Foundation, Inc. |
Copyright (C) 1998, 1999, 2004 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
40 |
#include <java_lang_Math.h> |
#include <java_lang_Math.h> |
41 |
#include <fdlibm.h> |
#include <fdlibm.h> |
42 |
|
|
43 |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_sin (JNIEnv *env, jclass cls, jdouble x) |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_sin |
44 |
|
(JNIEnv *env __attribute__((__unused__)), |
45 |
|
jclass cls __attribute__((__unused__)), |
46 |
|
jdouble x) |
47 |
{ |
{ |
48 |
return sin (x); |
return sin (x); |
49 |
} |
} |
50 |
|
|
51 |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_cos (JNIEnv *env, jclass cls, jdouble x) |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_cos |
52 |
|
(JNIEnv *env __attribute__((__unused__)), |
53 |
|
jclass cls __attribute__((__unused__)), |
54 |
|
jdouble x) |
55 |
{ |
{ |
56 |
return cos (x); |
return cos (x); |
57 |
} |
} |
58 |
|
|
59 |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_tan (JNIEnv *env, jclass cls, jdouble x) |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_tan |
60 |
|
(JNIEnv *env __attribute__((__unused__)), |
61 |
|
jclass cls __attribute__((__unused__)), |
62 |
|
jdouble x) |
63 |
{ |
{ |
64 |
return tan (x); |
return tan (x); |
65 |
} |
} |
66 |
|
|
67 |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_asin (JNIEnv *env, jclass cls, jdouble x) |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_asin |
68 |
|
(JNIEnv *env __attribute__((__unused__)), |
69 |
|
jclass cls __attribute__((__unused__)), |
70 |
|
jdouble x) |
71 |
{ |
{ |
72 |
return asin (x); |
return asin (x); |
73 |
} |
} |
74 |
|
|
75 |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_acos (JNIEnv *env, jclass cls, jdouble x) |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_acos |
76 |
|
(JNIEnv *env __attribute__((__unused__)), |
77 |
|
jclass cls __attribute__((__unused__)), |
78 |
|
jdouble x) |
79 |
{ |
{ |
80 |
return acos (x); |
return acos (x); |
81 |
} |
} |
82 |
|
|
83 |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_atan (JNIEnv *env, jclass cls, jdouble x) |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_atan |
84 |
|
(JNIEnv *env __attribute__((__unused__)), |
85 |
|
jclass cls __attribute__((__unused__)), |
86 |
|
jdouble x) |
87 |
{ |
{ |
88 |
return atan (x); |
return atan (x); |
89 |
} |
} |
90 |
|
|
91 |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_atan2 (JNIEnv *env, jclass cls, jdouble y, jdouble x) |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_atan2 |
92 |
|
(JNIEnv *env __attribute__((__unused__)), |
93 |
|
jclass cls __attribute__((__unused__)), |
94 |
|
jdouble y, jdouble x) |
95 |
{ |
{ |
96 |
return atan2 (y, x); |
return atan2 (y, x); |
97 |
} |
} |
98 |
|
|
99 |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_exp (JNIEnv *env, jclass cls, jdouble x) |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_exp |
100 |
|
(JNIEnv *env __attribute__((__unused__)), |
101 |
|
jclass cls __attribute__((__unused__)), |
102 |
|
jdouble x) |
103 |
{ |
{ |
104 |
return exp (x); |
return exp (x); |
105 |
} |
} |
106 |
|
|
107 |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_log (JNIEnv *env, jclass cls, jdouble x) |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_log |
108 |
|
(JNIEnv *env __attribute__((__unused__)), |
109 |
|
jclass cls __attribute__((__unused__)), |
110 |
|
jdouble x) |
111 |
{ |
{ |
112 |
return log (x); |
return log (x); |
113 |
} |
} |
114 |
|
|
115 |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_sqrt (JNIEnv *env, jclass cls, jdouble x) |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_sqrt |
116 |
|
(JNIEnv *env __attribute__((__unused__)), |
117 |
|
jclass cls __attribute__((__unused__)), |
118 |
|
jdouble x) |
119 |
{ |
{ |
120 |
return sqrt (x); |
return sqrt (x); |
121 |
} |
} |
122 |
|
|
123 |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_pow (JNIEnv *env, jclass cls, jdouble x, jdouble y) |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_pow |
124 |
|
(JNIEnv *env __attribute__((__unused__)), |
125 |
|
jclass cls __attribute__((__unused__)), |
126 |
|
jdouble x, jdouble y) |
127 |
{ |
{ |
128 |
return pow (x, y); |
return pow (x, y); |
129 |
} |
} |
130 |
|
|
131 |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_IEEEremainder (JNIEnv *env, jclass cls, jdouble x, jdouble y) |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_IEEEremainder |
132 |
|
(JNIEnv *env __attribute__((__unused__)), |
133 |
|
jclass cls __attribute__((__unused__)), |
134 |
|
jdouble x, jdouble y) |
135 |
{ |
{ |
136 |
return remainder (x, y); |
return remainder (x, y); |
137 |
} |
} |
138 |
|
|
139 |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_ceil (JNIEnv *env, jclass cls, jdouble x) |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_ceil |
140 |
|
(JNIEnv *env __attribute__((__unused__)), |
141 |
|
jclass cls __attribute__((__unused__)), |
142 |
|
jdouble x) |
143 |
{ |
{ |
144 |
return ceil (x); |
return ceil (x); |
145 |
} |
} |
146 |
|
|
147 |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_floor (JNIEnv *env, jclass cls, jdouble x) |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_floor |
148 |
|
(JNIEnv *env __attribute__((__unused__)), |
149 |
|
jclass cls __attribute__((__unused__)), |
150 |
|
jdouble x) |
151 |
{ |
{ |
152 |
return floor (x); |
return floor (x); |
153 |
} |
} |
154 |
|
|
155 |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_rint (JNIEnv *env, jclass cls, jdouble x) |
JNIEXPORT jdouble JNICALL Java_java_lang_Math_rint |
156 |
|
(JNIEnv *env __attribute__((__unused__)), |
157 |
|
jclass cls __attribute__((__unused__)), |
158 |
|
jdouble x) |
159 |
{ |
{ |
160 |
return rint (x); |
return rint (x); |
161 |
} |
} |