Skip to content

Commit 1670dc9

Browse files
Jeff BrownAndroid (Google) Code Review
authored andcommitted
Merge "Add FloatMath.exp." into jb-mr1-dev
2 parents b7df3a7 + 5d728bb commit 1670dc9

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
@@ -22821,6 +22821,7 @@ package android.util {
2282122821
public class FloatMath {
2282222822
method public static float ceil(float);
2282322823
method public static float cos(float);
22824+
method public static float exp(float);
2282422825
method public static float floor(float);
2282522826
method public static float sin(float);
2282622827
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)