32 bit vs 64 bit machine, same c++ code compiled on each....different numerical results!
-
This does not compute! Or does it?? I compiled the same code on a 32 bit machine and also on a 64 bit machine and when I run each one the numerical output is different. There are some overlapping results but there are others missing or extra in the others, or slightly different. How can this be?
-
This does not compute! Or does it?? I compiled the same code on a 32 bit machine and also on a 64 bit machine and when I run each one the numerical output is different. There are some overlapping results but there are others missing or extra in the others, or slightly different. How can this be?
ns wrote:
the numerical output is different.
Which output ? What are the differences ? What is your code doing ?
Cédric Moonen Software developer
Charting control [v3.0] OpenGL game tutorial in C++ -
This does not compute! Or does it?? I compiled the same code on a 32 bit machine and also on a 64 bit machine and when I run each one the numerical output is different. There are some overlapping results but there are others missing or extra in the others, or slightly different. How can this be?
if real numbers are involved, any change in compiler or compiler setting can influence the outcome; the difference may range from a change in one of the least significant digits, all the way up to an iterative process not converging any longer (which probably would indicate poor code, an unreliable algorithm or an ill-defined mathematical system). OTOH it could also be just a stupid bug, say a function parameter list getting misaligned because you didn't treat parameter types as they should (remember, pointers now become 8B, so they don't fit in an int anymore). :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
modified on Thursday, September 30, 2010 2:03 PM
-
This does not compute! Or does it?? I compiled the same code on a 32 bit machine and also on a 64 bit machine and when I run each one the numerical output is different. There are some overlapping results but there are others missing or extra in the others, or slightly different. How can this be?
ns wrote:
I compiled the same code on a 32 bit machine and also on a 64 bit machine
Compiled as 32 and 64 bits or using the same 32 bits exe on both machines ? are you doing low level operation on bits ? doing shift (for multiplcation/divisions) ? are you certain all the types you are using have the same size in 32 and 64 bits (loosing precision) ?
Watched code never compiles.
-
if real numbers are involved, any change in compiler or compiler setting can influence the outcome; the difference may range from a change in one of the least significant digits, all the way up to an iterative process not converging any longer (which probably would indicate poor code, an unreliable algorithm or an ill-defined mathematical system). OTOH it could also be just a stupid bug, say a function parameter list getting misaligned because you didn't treat parameter types as they should (remember, pointers now become 8B, so they don't fit in an int anymore). :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
modified on Thursday, September 30, 2010 2:03 PM
thank you all! I narrowed it down to where if I disable a certain custom function and call an alternate function, the same results are produced by both builds (64 bit and 32 bit machines) So I am going to inspect this function and see what gives. Appreciate the help and I will attempt to be more descriptive in my next question. :-D
-
This does not compute! Or does it?? I compiled the same code on a 32 bit machine and also on a 64 bit machine and when I run each one the numerical output is different. There are some overlapping results but there are others missing or extra in the others, or slightly different. How can this be?
Check for overflow. If doing a long string of computations, break them up; you may have precedence wrong.