Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. 32 bit vs 64 bit machine, same c++ code compiled on each....different numerical results!

32 bit vs 64 bit machine, same c++ code compiled on each....different numerical results!

Scheduled Pinned Locked Moved C / C++ / MFC
c++visual-studioquestion
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    ns
    wrote on last edited by
    #1

    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?

    C L M J 4 Replies Last reply
    0
    • N ns

      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?

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      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++

      1 Reply Last reply
      0
      • N ns

        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?

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        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

        N 1 Reply Last reply
        0
        • N ns

          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?

          M Offline
          M Offline
          Maximilien
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • L Luc Pattyn

            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

            N Offline
            N Offline
            ns
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • N ns

              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?

              J Offline
              J Offline
              Joe Woodbury
              wrote on last edited by
              #6

              Check for overflow. If doing a long string of computations, break them up; you may have precedence wrong.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups