• Post Reply Bookmark Topic Watch Topic
  • New Topic

program gives different results with same data  RSS feed

 
amit sharma
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I make program which do some manipulation on data from dataase and return a double value. It works fine there is no error .Problem is that with same data it gives different output .I can't understand it because logic is same ,data is same then why it produce different result .In my program i do calculation on double and then add all the previous double .I also use Double object .Is changing from string to Double object or double and adding all this figures will it give me different result.Is using d.doubleValue gives different result .
Thanks
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could be a phase of the moon issue.
 
Gavin Tranter
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if its floating point it oculd be a rounding error, try using strictfp/StrictMath
 
Paul Clapham
Sheriff
Posts: 22521
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you add the same floating-point numbers in different orders, it's possible to get different answers. But they normally won't be significantly different, unless the numbers vary considerably in size.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does your program use multiple threads at all? Behavior such as you describe is often a sign of problems with threading.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!