• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2006 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #define LOG_TAG "StrictMath"
18 
19 #include "../../external/fdlibm/fdlibm.h"
20 
21 #include "jni.h"
22 #include "JNIHelp.h"
23 #include "JniConstants.h"
24 
StrictMath_sin(JNIEnv *,jclass,jdouble a)25 static jdouble StrictMath_sin(JNIEnv*, jclass, jdouble a) {
26     return ieee_sin(a);
27 }
28 
StrictMath_cos(JNIEnv *,jclass,jdouble a)29 static jdouble StrictMath_cos(JNIEnv*, jclass, jdouble a) {
30     return ieee_cos(a);
31 }
32 
StrictMath_tan(JNIEnv *,jclass,jdouble a)33 static jdouble StrictMath_tan(JNIEnv*, jclass, jdouble a) {
34     return ieee_tan(a);
35 }
36 
StrictMath_asin(JNIEnv *,jclass,jdouble a)37 static jdouble StrictMath_asin(JNIEnv*, jclass, jdouble a) {
38     return ieee_asin(a);
39 }
40 
StrictMath_acos(JNIEnv *,jclass,jdouble a)41 static jdouble StrictMath_acos(JNIEnv*, jclass, jdouble a) {
42     return ieee_acos(a);
43 }
44 
StrictMath_atan(JNIEnv *,jclass,jdouble a)45 static jdouble StrictMath_atan(JNIEnv*, jclass, jdouble a) {
46     return ieee_atan(a);
47 }
48 
StrictMath_exp(JNIEnv *,jclass,jdouble a)49 static jdouble StrictMath_exp(JNIEnv*, jclass, jdouble a) {
50     return ieee_exp(a);
51 }
52 
StrictMath_log(JNIEnv *,jclass,jdouble a)53 static jdouble StrictMath_log(JNIEnv*, jclass, jdouble a) {
54     return ieee_log(a);
55 }
56 
StrictMath_sqrt(JNIEnv *,jclass,jdouble a)57 static jdouble StrictMath_sqrt(JNIEnv*, jclass, jdouble a) {
58     return ieee_sqrt(a);
59 }
60 
StrictMath_IEEEremainder(JNIEnv *,jclass,jdouble a,jdouble b)61 static jdouble StrictMath_IEEEremainder(JNIEnv*, jclass, jdouble a, jdouble b) {
62     return ieee_remainder(a, b);
63 }
64 
StrictMath_floor(JNIEnv *,jclass,jdouble a)65 static jdouble StrictMath_floor(JNIEnv*, jclass, jdouble a) {
66     return ieee_floor(a);
67 }
68 
StrictMath_ceil(JNIEnv *,jclass,jdouble a)69 static jdouble StrictMath_ceil(JNIEnv*, jclass, jdouble a) {
70     return ieee_ceil(a);
71 }
72 
StrictMath_rint(JNIEnv *,jclass,jdouble a)73 static jdouble StrictMath_rint(JNIEnv*, jclass, jdouble a) {
74     return ieee_rint(a);
75 }
76 
StrictMath_atan2(JNIEnv *,jclass,jdouble a,jdouble b)77 static jdouble StrictMath_atan2(JNIEnv*, jclass, jdouble a, jdouble b) {
78     return ieee_atan2(a, b);
79 }
80 
StrictMath_pow(JNIEnv *,jclass,jdouble a,jdouble b)81 static jdouble StrictMath_pow(JNIEnv*, jclass, jdouble a, jdouble b) {
82     return ieee_pow(a,b);
83 }
84 
StrictMath_sinh(JNIEnv *,jclass,jdouble a)85 static jdouble StrictMath_sinh(JNIEnv*, jclass, jdouble a) {
86     return ieee_sinh(a);
87 }
88 
StrictMath_tanh(JNIEnv *,jclass,jdouble a)89 static jdouble StrictMath_tanh(JNIEnv*, jclass, jdouble a) {
90     return ieee_tanh(a);
91 }
92 
StrictMath_cosh(JNIEnv *,jclass,jdouble a)93 static jdouble StrictMath_cosh(JNIEnv*, jclass, jdouble a) {
94     return ieee_cosh(a);
95 }
96 
StrictMath_log10(JNIEnv *,jclass,jdouble a)97 static jdouble StrictMath_log10(JNIEnv*, jclass, jdouble a) {
98     return ieee_log10(a);
99 }
100 
StrictMath_cbrt(JNIEnv *,jclass,jdouble a)101 static jdouble StrictMath_cbrt(JNIEnv*, jclass, jdouble a) {
102     return ieee_cbrt(a);
103 }
104 
StrictMath_expm1(JNIEnv *,jclass,jdouble a)105 static jdouble StrictMath_expm1(JNIEnv*, jclass, jdouble a) {
106     return ieee_expm1(a);
107 }
108 
StrictMath_hypot(JNIEnv *,jclass,jdouble a,jdouble b)109 static jdouble StrictMath_hypot(JNIEnv*, jclass, jdouble a, jdouble b) {
110     return ieee_hypot(a, b);
111 }
112 
StrictMath_log1p(JNIEnv *,jclass,jdouble a)113 static jdouble StrictMath_log1p(JNIEnv*, jclass, jdouble a) {
114     return ieee_log1p(a);
115 }
116 
StrictMath_nextafter(JNIEnv *,jclass,jdouble a,jdouble b)117 static jdouble StrictMath_nextafter(JNIEnv*, jclass, jdouble a, jdouble b) {
118     return ieee_nextafter(a, b);
119 }
120 
121 static JNINativeMethod gMethods[] = {
122     NATIVE_METHOD(StrictMath, IEEEremainder, "!(DD)D"),
123     NATIVE_METHOD(StrictMath, acos, "!(D)D"),
124     NATIVE_METHOD(StrictMath, asin, "!(D)D"),
125     NATIVE_METHOD(StrictMath, atan, "!(D)D"),
126     NATIVE_METHOD(StrictMath, atan2, "!(DD)D"),
127     NATIVE_METHOD(StrictMath, cbrt, "!(D)D"),
128     NATIVE_METHOD(StrictMath, ceil, "!(D)D"),
129     NATIVE_METHOD(StrictMath, cos, "!(D)D"),
130     NATIVE_METHOD(StrictMath, cosh, "!(D)D"),
131     NATIVE_METHOD(StrictMath, exp, "!(D)D"),
132     NATIVE_METHOD(StrictMath, expm1, "!(D)D"),
133     NATIVE_METHOD(StrictMath, floor, "!(D)D"),
134     NATIVE_METHOD(StrictMath, hypot, "!(DD)D"),
135     NATIVE_METHOD(StrictMath, log, "!(D)D"),
136     NATIVE_METHOD(StrictMath, log10, "!(D)D"),
137     NATIVE_METHOD(StrictMath, log1p, "!(D)D"),
138     NATIVE_METHOD(StrictMath, nextafter, "!(DD)D"),
139     NATIVE_METHOD(StrictMath, pow, "!(DD)D"),
140     NATIVE_METHOD(StrictMath, rint, "!(D)D"),
141     NATIVE_METHOD(StrictMath, sin, "!(D)D"),
142     NATIVE_METHOD(StrictMath, sinh, "!(D)D"),
143     NATIVE_METHOD(StrictMath, sqrt, "!(D)D"),
144     NATIVE_METHOD(StrictMath, tan, "!(D)D"),
145     NATIVE_METHOD(StrictMath, tanh, "!(D)D"),
146 };
register_java_lang_StrictMath(JNIEnv * env)147 void register_java_lang_StrictMath(JNIEnv* env) {
148     jniRegisterNativeMethods(env, "java/lang/StrictMath", gMethods, NELEM(gMethods));
149 }
150