Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (293)
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 1090 times)
0 Members and 1 Guest are viewing this topic.
Offline genepi

Senior Newbie




azerty


« Posted 2003-04-22 18: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 Member




ROCK!!!


« Reply #1 - Posted 2003-04-22 20: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 20: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 18: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.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (67 views)
2013-05-17 21:29:12

alaslipknot (76 views)
2013-05-16 21:24:48

gouessej (109 views)
2013-05-16 00:53:38

gouessej (104 views)
2013-05-16 00:17:58

theagentd (115 views)
2013-05-15 15:01:13

theagentd (104 views)
2013-05-15 15:00:54

StreetDoggy (149 views)
2013-05-14 15:56:26

kutucuk (172 views)
2013-05-12 17:10:36

kutucuk (170 views)
2013-05-12 15:36:09

UnluckyDevil (179 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.091 seconds with 20 queries.