| Author |
program gives different results with same data
|
amit sharma
Ranch Hand
Joined: Jul 19, 2006
Posts: 129
|
|
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
Joined: Oct 30, 2001
Posts: 1970
|
|
|
Could be a phase of the moon issue.
|
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.<br /> <br />#:^P
|
 |
Gavin Tranter
Ranch Hand
Joined: Jan 01, 2007
Posts: 333
|
|
|
if its floating point it oculd be a rounding error, try using strictfp/StrictMath
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16487
|
|
|
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
Joined: Jan 30, 2000
Posts: 18670
|
|
|
Does your program use multiple threads at all? Behavior such as you describe is often a sign of problems with threading.
|
"I'm not back." - Bill Harding, Twister
|
 |
 |
|
|
subject: program gives different results with same data
|
|
|