190 return ((jdouble)fmod((double)x,(double)y)); |
190 return ((jdouble)fmod((double)x,(double)y)); |
191 JRT_END |
191 JRT_END |
192 |
192 |
193 |
193 |
194 JRT_LEAF(jint, SharedRuntime::f2i(jfloat x)) |
194 JRT_LEAF(jint, SharedRuntime::f2i(jfloat x)) |
195 if (g_isnan(x)) {return 0;} |
195 if (g_isnan(x)) |
196 jlong lltmp = (jlong)x; |
196 return 0; |
197 jint ltmp = (jint)lltmp; |
197 if (x >= (jfloat) max_jint) |
198 if (ltmp == lltmp) { |
198 return max_jint; |
199 return ltmp; |
199 if (x <= (jfloat) min_jint) |
200 } else { |
200 return min_jint; |
201 if (x < 0) { |
201 return (jint) x; |
202 return min_jint; |
|
203 } else { |
|
204 return max_jint; |
|
205 } |
|
206 } |
|
207 JRT_END |
202 JRT_END |
208 |
203 |
209 |
204 |
210 JRT_LEAF(jlong, SharedRuntime::f2l(jfloat x)) |
205 JRT_LEAF(jlong, SharedRuntime::f2l(jfloat x)) |
211 if (g_isnan(x)) {return 0;} |
206 if (g_isnan(x)) |
212 jlong lltmp = (jlong)x; |
207 return 0; |
213 if (lltmp != min_jlong) { |
208 if (x >= (jfloat) max_jlong) |
214 return lltmp; |
209 return max_jlong; |
215 } else { |
210 if (x <= (jfloat) min_jlong) |
216 if (x < 0) { |
211 return min_jlong; |
217 return min_jlong; |
212 return (jlong) x; |
218 } else { |
|
219 return max_jlong; |
|
220 } |
|
221 } |
|
222 JRT_END |
213 JRT_END |
223 |
214 |
224 |
215 |
225 JRT_LEAF(jint, SharedRuntime::d2i(jdouble x)) |
216 JRT_LEAF(jint, SharedRuntime::d2i(jdouble x)) |
226 if (g_isnan(x)) {return 0;} |
217 if (g_isnan(x)) |
227 jlong lltmp = (jlong)x; |
218 return 0; |
228 jint ltmp = (jint)lltmp; |
219 if (x >= (jdouble) max_jint) |
229 if (ltmp == lltmp) { |
220 return max_jint; |
230 return ltmp; |
221 if (x <= (jdouble) min_jint) |
231 } else { |
222 return min_jint; |
232 if (x < 0) { |
223 return (jint) x; |
233 return min_jint; |
|
234 } else { |
|
235 return max_jint; |
|
236 } |
|
237 } |
|
238 JRT_END |
224 JRT_END |
239 |
225 |
240 |
226 |
241 JRT_LEAF(jlong, SharedRuntime::d2l(jdouble x)) |
227 JRT_LEAF(jlong, SharedRuntime::d2l(jdouble x)) |
242 if (g_isnan(x)) {return 0;} |
228 if (g_isnan(x)) |
243 jlong lltmp = (jlong)x; |
229 return 0; |
244 if (lltmp != min_jlong) { |
230 if (x >= (jdouble) max_jlong) |
245 return lltmp; |
231 return max_jlong; |
246 } else { |
232 if (x <= (jdouble) min_jlong) |
247 if (x < 0) { |
233 return min_jlong; |
248 return min_jlong; |
234 return (jlong) x; |
249 } else { |
|
250 return max_jlong; |
|
251 } |
|
252 } |
|
253 JRT_END |
235 JRT_END |
254 |
236 |
255 |
237 |
256 JRT_LEAF(jfloat, SharedRuntime::d2f(jdouble x)) |
238 JRT_LEAF(jfloat, SharedRuntime::d2f(jdouble x)) |
257 return (jfloat)x; |
239 return (jfloat)x; |