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 25 static jdouble StrictMath_sin(JNIEnv*, jclass, jdouble a) { 26 return ieee_sin(a); 27 } 28 29 static jdouble StrictMath_cos(JNIEnv*, jclass, jdouble a) { 30 return ieee_cos(a); 31 } 32 33 static jdouble StrictMath_tan(JNIEnv*, jclass, jdouble a) { 34 return ieee_tan(a); 35 } 36 37 static jdouble StrictMath_asin(JNIEnv*, jclass, jdouble a) { 38 return ieee_asin(a); 39 } 40 41 static jdouble StrictMath_acos(JNIEnv*, jclass, jdouble a) { 42 return ieee_acos(a); 43 } 44 45 static jdouble StrictMath_atan(JNIEnv*, jclass, jdouble a) { 46 return ieee_atan(a); 47 } 48 49 static jdouble StrictMath_exp(JNIEnv*, jclass, jdouble a) { 50 return ieee_exp(a); 51 } 52 53 static jdouble StrictMath_log(JNIEnv*, jclass, jdouble a) { 54 return ieee_log(a); 55 } 56 57 static jdouble StrictMath_sqrt(JNIEnv*, jclass, jdouble a) { 58 return ieee_sqrt(a); 59 } 60 61 static jdouble StrictMath_IEEEremainder(JNIEnv*, jclass, jdouble a, jdouble b) { 62 return ieee_remainder(a, b); 63 } 64 65 static jdouble StrictMath_floor(JNIEnv*, jclass, jdouble a) { 66 return ieee_floor(a); 67 } 68 69 static jdouble StrictMath_ceil(JNIEnv*, jclass, jdouble a) { 70 return ieee_ceil(a); 71 } 72 73 static jdouble StrictMath_rint(JNIEnv*, jclass, jdouble a) { 74 return ieee_rint(a); 75 } 76 77 static jdouble StrictMath_atan2(JNIEnv*, jclass, jdouble a, jdouble b) { 78 return ieee_atan2(a, b); 79 } 80 81 static jdouble StrictMath_pow(JNIEnv*, jclass, jdouble a, jdouble b) { 82 return ieee_pow(a,b); 83 } 84 85 static jdouble StrictMath_sinh(JNIEnv*, jclass, jdouble a) { 86 return ieee_sinh(a); 87 } 88 89 static jdouble StrictMath_tanh(JNIEnv*, jclass, jdouble a) { 90 return ieee_tanh(a); 91 } 92 93 static jdouble StrictMath_cosh(JNIEnv*, jclass, jdouble a) { 94 return ieee_cosh(a); 95 } 96 97 static jdouble StrictMath_log10(JNIEnv*, jclass, jdouble a) { 98 return ieee_log10(a); 99 } 100 101 static jdouble StrictMath_cbrt(JNIEnv*, jclass, jdouble a) { 102 return ieee_cbrt(a); 103 } 104 105 static jdouble StrictMath_expm1(JNIEnv*, jclass, jdouble a) { 106 return ieee_expm1(a); 107 } 108 109 static jdouble StrictMath_hypot(JNIEnv*, jclass, jdouble a, jdouble b) { 110 return ieee_hypot(a, b); 111 } 112 113 static jdouble StrictMath_log1p(JNIEnv*, jclass, jdouble a) { 114 return ieee_log1p(a); 115 } 116 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 }; 147 148 void register_java_lang_StrictMath(JNIEnv* env) { 149 jniRegisterNativeMethods(env, "java/lang/StrictMath", gMethods, NELEM(gMethods)); 150 } 151