public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
* formatting floating point problem
@ 2010-05-09 23:19 Erwin Kalvelagen
  2010-05-10  8:10 ` Andrew Haley
  0 siblings, 1 reply; 2+ messages in thread
From: Erwin Kalvelagen @ 2010-05-09 23:19 UTC (permalink / raw)
  To: java

Hi,

I am wondering what I am doing wrong here.

erwin@erwin-laptop:~/jtest$ cat tst.java
public class tst {

	public static void main(String[] args) {
		double d = 0.8;
		System.out.format("[%g]%n",d);
	}
}
erwin@erwin-laptop:~/jtest$ gcj --main=tst tst.java
erwin@erwin-laptop:~/jtest$ ./a.out
[]
erwin@erwin-laptop:~/jtest$ gcj -v
Using built-in specs.
Reading specs from /usr/lib/gcc/i486-linux-gnu/4.4.3/libgcj.spec
rename spec startfile to startfileorig
rename spec lib to liborig
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
4.4.3-1ubuntu2'
--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
--disable-werror --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.3 (Ubuntu 4.4.3-1ubuntu2)
erwin@erwin-laptop:~/jtest$


With Sun's java I get actually something printed.


Thanks, Erwin


----------------------------------------------------------------
Erwin Kalvelagen
Amsterdam Optimization Modeling Group
erwin@amsterdamoptimization.com
http://amsterdamoptimization.com
----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: formatting floating point problem
  2010-05-09 23:19 formatting floating point problem Erwin Kalvelagen
@ 2010-05-10  8:10 ` Andrew Haley
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Haley @ 2010-05-10  8:10 UTC (permalink / raw)
  To: Erwin Kalvelagen; +Cc: java

On 05/10/2010 12:19 AM, Erwin Kalvelagen wrote:

> I am wondering what I am doing wrong here.
> 
> erwin@erwin-laptop:~/jtest$ cat tst.java
> public class tst {
> 
> 	public static void main(String[] args) {
> 		double d = 0.8;
> 		System.out.format("[%g]%n",d);
> 	}
> }
> erwin@erwin-laptop:~/jtest$ gcj --main=tst tst.java
> erwin@erwin-laptop:~/jtest$ ./a.out
> []

Sorry, it looks like code to do that was never contributed to GNU Classpath.
Patches welcome.

Andrew.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-10  8:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-09 23:19 formatting floating point problem Erwin Kalvelagen
2010-05-10  8:10 ` Andrew Haley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).