Date: Sun, 11 Jul 1999 19:22:57 +0900 From: SHUDO Kazuyuki <shudoh@muraoka.info.waseda.ac.jp> To: freebsd-java@FreeBSD.ORG Subject: Re: strange java calculation errors Message-ID: <199907111022.TAA17788@cafe.muraoka.info.waseda.ac.jp> In-Reply-To: Your message of "Fri, 09 Jul 1999 16:04:32 CST." <199907092204.QAA09955@mt.sri.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> > > > >I use the latest jdk1.1.8_ELF.V99-6-3.tar.gz with applied net-patch. > > > > >On a few-weeks-old 3.2-STABLE. > > > > >I have strange arithmetic errors. > > Ok, I set up a sample program. I think it needs to be an awt-application. > > I don't get any errors without setVisible(), but with a visible frame > > I get errors every few seconds. It has to be a Thread, too, I think. > > Martin > > > > //BugTest.java ---------------------------------------------- I could simplify this code a bit. Math.pow(...) returns a strange value occasionally. Moving a mouse pointer on the frame seems to increase the frequency of errors. Kazuyuki SHUDO Happy Hacking! Muraoka Lab., Grad. School of Sci. & Eng., Waseda Univ. ========== import java.awt.*; import java.util.Random; public class BugTest extends Frame implements Runnable { public BugTest(){ setSize(100,100); setVisible(true); } public void run(){ double base, pow; Random random = new Random(); while (true){ base = random.nextDouble() * 10.0; pow = Math.pow(base, 3.9); if (pow < 1.0e-200) { System.out.println(); System.out.println("base: " + base + " (0x" + Long.toHexString(Double.doubleToLongBits(base)) + ")"); System.out.println("pow: " + pow + " (0x" + Long.toHexString(Double.doubleToLongBits(pow)) + ")"); } } } public static void main(String args[]){ BugTest bug = new BugTest(); Thread bugThread = new Thread(bug); bugThread.setPriority(Thread.MIN_PRIORITY); bugThread.start(); } } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199907111022.TAA17788>