Looking at: http://developer.classpath.org/doc/java/util/Formatter-source.html#line.1393 the printf flags %e, %f, %g and %a aren't implemented. For example, the simple test: class a { public static void main(String args[]) { System.out.printf("XXX%7.3fYYY",1234567.123); } } will print XXXYYY and not XXX1234567.123YYY.
Yeah, nobody implemented the floating point support yet.
I'll take a look at this. May be possible to handle it using DecimalFormat.
*** Bug 36434 has been marked as a duplicate of this bug. ***
Also %x does an unwanted sign-extension to long from int. class Test { public static void main(String argv[]) { System.out.printf("%x\n", new Integer(0x80000000)); } } % gcj -Wall Test.java --main=Test -o Test % ./Test ffffffff80000000 % % gcj -v Using built-in specs. Reading specs from /usr/lib/gcc/i486-linux-gnu/4.4.2/libgcj.spec rename spec startfile to startfileorig rename spec lib to liborig Target: i486-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.2-7' --with-bugurl=file:///usr/share/doc/gcj-4.4/README.Bugs --enable-languages=c,c++,java --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --disable-libmudflap --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=//usr/lib/jvm/java-1.5.0-gcj-4.4/jre --enable-java-home --with-jvm-root-dir=//usr/lib/jvm/java-1.5.0-gcj-4.4 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.4 --with-arch-directory=i386 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-targets=all --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu Thread model: posix gcc version 4.4.2 (Debian 4.4.2-7) The right output is produced from the class file by the java virtual machine % gcj -Wall Test.java -C % java Test 80000000
FYI: Support for the %f flag is needed to successfully run the h2 benchmark from DaCapo 9.12. More specifically, it is necessary to complete the output verification because the missing %f support leads to percentages not being displayed correctly. Quentin Sabah has provided a patch for the Jikes RVM which adds limited support for the %f flag. You can find it at http://jira.codehaus.org/browse/RVM-1047 .