Skip to content

Commit 5d728bb

Browse files
author
Jeff Brown
committed
Add FloatMath.exp.
Change-Id: I7f215e5fd4cb942ddee56eebaef04be565ac79f3
1 parent 2ab1b7d commit 5d728bb

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

api/current.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22810,6 +22810,7 @@ package android.util {
2281022810
public class FloatMath {
2281122811
method public static float ceil(float);
2281222812
method public static float cos(float);
22813+
method public static float exp(float);
2281322814
method public static float floor(float);
2281422815
method public static float sin(float);
2281522816
method public static float sqrt(float);

core/java/android/util/FloatMath.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,13 @@ private FloatMath() {}
7171
* @return the square root of value
7272
*/
7373
public static native float sqrt(float value);
74+
75+
/**
76+
* Returns the closest float approximation of the raising "e" to the power
77+
* of the argument.
78+
*
79+
* @param value to compute the exponential of
80+
* @return the exponential of value
81+
*/
82+
public static native float exp(float value);
7483
}

core/jni/android_util_FloatMath.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,19 @@ class MathUtilsGlue {
2525
static float SqrtF(JNIEnv* env, jobject clazz, float x) {
2626
return sqrtf(x);
2727
}
28+
29+
static float ExpF(JNIEnv* env, jobject clazz, float x) {
30+
return expf(x);
31+
}
2832
};
2933

3034
static JNINativeMethod gMathUtilsMethods[] = {
3135
{"floor", "(F)F", (void*) MathUtilsGlue::FloorF},
3236
{"ceil", "(F)F", (void*) MathUtilsGlue::CeilF},
3337
{"sin", "(F)F", (void*) MathUtilsGlue::SinF},
3438
{"cos", "(F)F", (void*) MathUtilsGlue::CosF},
35-
{"sqrt", "(F)F", (void*) MathUtilsGlue::SqrtF}
39+
{"sqrt", "(F)F", (void*) MathUtilsGlue::SqrtF},
40+
{"exp", "(F)F", (void*) MathUtilsGlue::ExpF},
3641
};
3742

3843
int register_android_util_FloatMath(JNIEnv* env)

0 commit comments

Comments
 (0)