Implemented printing of doubles using snprintf

This commit is contained in:
Eric Scharff 2007-10-02 09:23:49 -06:00
parent 243d62a952
commit 7bc85a1247
2 changed files with 7 additions and 4 deletions

View File

@ -71,8 +71,11 @@ Java_java_lang_System_doMapLibraryName(JNIEnv* e, jclass, jstring name)
}
extern "C" JNIEXPORT jint JNICALL
Java_java_lang_Double_fillBufferWithDouble(JNIEnv *e, jclass me, jdouble val,
Java_java_lang_Double_fillBufferWithDouble(JNIEnv *e, jclass, jdouble val,
jbyteArray buffer, jint bufferSize) {
if (e or me or val or buffer or bufferSize) return 0;
return 0;
jboolean isCopy;
jbyte* buf = e->GetByteArrayElements(buffer, &isCopy);
jint count = snprintf(reinterpret_cast<char*>(buf), bufferSize, "%g", val);
e->ReleaseByteArrayElements(buffer, buf, 0);
return count;
}

View File

@ -26,7 +26,7 @@ public final class Float extends Number {
}
public static String toString(float v) {
return "Float.toString: todo";
return Double.toString(v);
}
public byte byteValue() {