This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Strange result from double comparison

 
Siamak Saarmann
Ranch Hand
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a simple comparison of two double numbers. The same comparison when put in println function gives the correct response (see in the output) but the same comparison if assigned to a boolean value gives a wrong response;

I tried to compare numbers inside if condition, in a boolean variable, in reverse for (i.e: gone > MAX_MOVE) but every time it fails.

Could someone please tell me what is wrong?

I have narrowed down a bug in 20,000 lines of code to this and I can not figure out the reason.

Thank you.
Mac

 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

i tried it is working...i do not find any issue..please can you explain clearly?

thanks & regards,
seetharaman
 
Siamak Saarmann
Ranch Hand
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure what is the problem. It works on my home PC, but as you see the output (printout of the variables) it did not work on my PC in university.

(gone<= MAX_MOVE) has given a different value in 2nd output line than the one coming from boolean variable.

I really don't know... This has happened for the first time in several years.
[ May 05, 2008: Message edited by: Siamak Saarmann ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic