converting jdouble to double of type c
c, java, java-native-interface
Solution
You don't have to, it's just a typedef like so:
typedef double jdouble;
So no conversion is needed, once you have a `jdouble` you can treat it just as a `double`.
See for instance this code example from Standford:
JNIEXPORT jdouble JNICALL Java_Summer_sum__DD
(JNIEnv *env, jobject jobj, jdouble j1, jdouble j2) {
return j1 + j2;
}
The addition is done directly with the `jdouble` values, trusting the compiler to figure out how to generate the required code.
Problem
How can i convert `jdouble` of java type variable to `double` variable of type c ?