android - Why are incorrect values being passed between Java and C++ via JNI? -


i want pass double value c++ java (android) using jni.

relevant c++ code:

jniexport jdouble jnicall java_test_mpeg_dash_ffmpeg_playerui_notif(jnienv* env, jobject obj,jint st){      jdouble p=receiver->buffer->notify();     logi("notifyyyyyyyyy jni %d ",p);     return p; } 

displays 35, 36, etc

when accessed in java calling native method, wrong values returned: 0.0000133333

relevant java code:

double buf=notify(); log.d(tag, "bufffffffffffffffffffffffffer :"+buf" ms"); 

why values inconsistent?

"%d" not format specifier compatible floating point types. if use it, force misinterpretation of bits comprising jdouble, , print incorrect value.

it's value returned java correct (there's fair amount of type enforcement there), , being logged incorrect.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -