Add FloatMath.exp.
Change-Id: I7f215e5fd4cb942ddee56eebaef04be565ac79f3
diff --git a/api/current.txt b/api/current.txt
index f594205..d246b09 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -22810,6 +22810,7 @@
public class FloatMath {
method public static float ceil(float);
method public static float cos(float);
+ method public static float exp(float);
method public static float floor(float);
method public static float sin(float);
method public static float sqrt(float);
diff --git a/core/java/android/util/FloatMath.java b/core/java/android/util/FloatMath.java
index 6216638..1d4eda4 100644
--- a/core/java/android/util/FloatMath.java
+++ b/core/java/android/util/FloatMath.java
@@ -71,4 +71,13 @@
* @return the square root of value
*/
public static native float sqrt(float value);
+
+ /**
+ * Returns the closest float approximation of the raising "e" to the power
+ * of the argument.
+ *
+ * @param value to compute the exponential of
+ * @return the exponential of value
+ */
+ public static native float exp(float value);
}
diff --git a/core/jni/android_util_FloatMath.cpp b/core/jni/android_util_FloatMath.cpp
index f38faa9..e30756b 100644
--- a/core/jni/android_util_FloatMath.cpp
+++ b/core/jni/android_util_FloatMath.cpp
@@ -25,6 +25,10 @@
static float SqrtF(JNIEnv* env, jobject clazz, float x) {
return sqrtf(x);
}
+
+ static float ExpF(JNIEnv* env, jobject clazz, float x) {
+ return expf(x);
+ }
};
static JNINativeMethod gMathUtilsMethods[] = {
@@ -32,7 +36,8 @@
{"ceil", "(F)F", (void*) MathUtilsGlue::CeilF},
{"sin", "(F)F", (void*) MathUtilsGlue::SinF},
{"cos", "(F)F", (void*) MathUtilsGlue::CosF},
- {"sqrt", "(F)F", (void*) MathUtilsGlue::SqrtF}
+ {"sqrt", "(F)F", (void*) MathUtilsGlue::SqrtF},
+ {"exp", "(F)F", (void*) MathUtilsGlue::ExpF},
};
int register_android_util_FloatMath(JNIEnv* env)