Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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 2307 times)
0 Members and 1 Guest are viewing this topic.
Offline genepi

Senior Newbie


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


I've written a small benchmark to test the processing power of the new Sharp Zaurus PDA models.

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 or Sun Personal Profile
Offline leknor

Junior Devvie


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

Check the strictfp keyword:
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


« 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


« 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  

EgonOlsen (78 views)
2018-06-10 19:43:48

EgonOlsen (58 views)
2018-06-10 19:43:44

EgonOlsen (78 views)
2018-06-10 19:43:20

DesertCoockie (260 views)
2018-05-13 18:23:11

nelsongames (158 views)
2018-04-24 18:15:36

nelsongames (157 views)
2018-04-24 18:14:32

ivj94 (898 views)
2018-03-24 14:47:39

ivj94 (162 views)
2018-03-24 14:46:31

ivj94 (811 views)
2018-03-24 14:43:53

Solater (175 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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‑
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!