Do different CPUs treat BODMAS in a different order to others?
funchop
2006-09-15 03:42:16 UTC
I have made a program with a lot of equations in and if i run it from different computers i get a different result with the same numbers. Any ideas?
Eight answers:
2006-09-15 03:44:38 UTC
Does your program use a random number generator?
skiparoouk
2006-09-15 11:59:24 UTC
It's not the CPU. More likely to be a different version of the release/version of the operating system and/or any compilers/runtime you might be using. Do you recompile on the other machine?
Have you tried recompiling on the other machine and then tranferring to the 'orignal' and seeing if it still generates different results?
Then try it in a different language and see if you still get different results.
After that you'll have to do a binary chop type of exercise to see which part of the equation is causing the difference.
Dan M
2006-09-16 00:44:26 UTC
There are acouple of things to watch:
The X86 FPU actually works at excess precision, so that it is possible dependng on exactly how the compiler/OS have set up the FPU state for you to get slightly different results, in a numerically unstable problem this can cause effectively random results after running for a while.
Similarly, results will differ on other architectures as they may have different FPU internal word lengths.
Finally handling of things like denormals and NAN can differ between platforms and even have different defaults in different tool chains.
Then there is the possibility (Likely) of a straightforward bug in your code, endian issues, compiler bugs.... Lots of ways for it to all go pearshaped.
Regards, Dan.
Paul B
2006-09-15 14:18:46 UTC
It maynot be the Operator order if the program is written in C and the cpus are different (eg. Intel or PowerPC) then it maybe big or little endian you are running into and you may need to compile for each type of CPU.
I dont know for sure just food for thought.
taral
2006-09-15 10:45:55 UTC
No the answer remains the same on every computer bcoz there is no such thing like different processing
Siu02rk
2006-09-15 13:13:59 UTC
No. Are you inputting the numbers or are they predefined? Try predefining your variables and see if that works.
Hachi
2006-09-15 10:45:43 UTC
NO... Its BODMAS. it already has an Order
2006-09-16 06:44:40 UTC
no it doesn't
ⓘ
This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.