Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (517)
Games in Android Showcase (123)
games submitted by our members
Games in WIP (578)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Strange double calculation result with JDK1.4.2  (Read 1348 times)
0 Members and 1 Guest are viewing this topic.
Offline genepi

Senior Newbie




azerty


« Posted 2003-04-22 16:05:23 »

Hi,

I've written a small benchmark to test the processing power of the new Sharp Zaurus PDA models.http://www.alterna.tv/zjb/Zjb.java

Then I wanted to compare the result with my workstation, with JDK 1.4.2 Beta. And I was really surprised to discover that the Pi calculation was giving a wrong result: Pi=3.1413934230804443!

This only happens when running the whole program AND with JDK1.4.2.
I had no problems when:
- using other JDK: 1.4.1, 1.4.1_01, 1.3.1_01, 1.1.8
- using other platforms: PC, Zaurus
- extracting the Pi calculation fragment, with/without previous code...

So it must be:
0) A bug in my code, but I can't pinpoint it.
1) A problem in my workstation configuration. Apart from setting up JDK1.4.2, nothing new has happened recently.
2) A bug in the platform/OS. Could a new Win2K hotfix have broken a fix for a hardware problem, and Sun coincidentaly has removed the support from the JVM Tongue My platform is a Win2K SP3 2xPII 350MHz.
3) A normal bug encountered in Beta software. Never play with Beta software keep saying my mother Wink
4) An alien cause not listed in software development courses...

Could someone with a 1.4.2 JDK setup try my code and check the Pi value?
There's no need reporting the problem to Sun if it's not point 2) or 3).

As a bonus, you'll can compare the performance of your workstation with a Zaurus SL-5500 PDA running Jeode http://www.alterna.tv/zjb/zjb-SL-5500.png or Sun Personal Profile http://www.alterna.tv/zjb/zjb-SL-5500-Sun.png.
Offline leknor

Junior Duke




ROCK!!!


« Reply #1 - Posted 2003-04-22 18:06:18 »

Check the strictfp keyword:
http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#249198
I'm not sure if it will fix PI for you but it could explain your problem and how it could be legal.
Offline genepi

Senior Newbie




azerty


« Reply #2 - Posted 2003-04-22 18:42:15 »

Hi leknor,

Thanks. I've forgotten to say that I had already tried the strictfp modifier and it does not help: I got the same result on my workstation...

That's really strange, because I can switch the JVM in Eclipse (or on the command line) at will, and I get a different result only on that test! And on the Zaurus with FP emulator, I get it right!

But I have no another PC where to try another JDK1.4.2 setup and check if it's a configuration problem... Tongue
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline genepi

Senior Newbie




azerty


« Reply #3 - Posted 2003-04-23 16:50:24 »

OK, I've found another PC where to setup JRE 1.4.2Beta. The problem still occurs and seems to be related to the new JVM (Sun Bugs #4843257 & 4828693).

Conclusion: don't use the 1.4.2Beta with intensive float calculations!
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

DarkCart (18 views)
2014-10-31 21:44:48

DarkCart (23 views)
2014-10-31 21:43:57

TehJavaDev (40 views)
2014-10-27 03:28:38

TehJavaDev (31 views)
2014-10-27 03:27:51

DarkCart (45 views)
2014-10-26 19:37:11

Luminem (27 views)
2014-10-26 10:17:50

Luminem (31 views)
2014-10-26 10:14:04

theagentd (36 views)
2014-10-25 15:46:29

Longarmx (64 views)
2014-10-17 03:59:02

Norakomi (62 views)
2014-10-16 15:22:06
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!