Floating point computations differ in different runs of same program

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts

  • dohboy
    Guest replied
    Re: Floating point computations differ in different runs of same program

    On Thu, 14 Feb 2008 16:59:27 +0100, "Fred Zwarts" <F.Zwarts@KVI.n lwrote:
    >"Rahul" <rahulsharma@lu cent.comwrote in message news:1209312c-0031-4a44-9ccb-bf02e3cfe680@s1 9g2000prg.googl egroups.com...
    >Hi,
    >>
    >I have a C program which does lots of computations in floats and
    >doubles,
    >It is processing the same file (same data) but in different runs of
    >the program (on the same machine) the results vary sometimes by
    >numeric value 1 (which is after rounding the resulting float number)
    >Is this expected behavior with floats and doulbe (with lots of
    >intermediate conversion in between) ?
    >>
    >Since There is only one thread so I guess the result should be same
    >always.
    >>
    >Any reason/pointers for the above mentioned behavior.
    >
    >Possible causes are:
    + Use of uninitialized variables.
    + Use of a random generator.
    + Use of the changing environment, e.g. the current time.
    + ...
    Maybe a vortex in the space-time continuum. It happens to my programs all the time. ;-)
    Possibly explains what happens to my socks in the dryer, too.

    Leave a comment:


  • Fred Zwarts
    Guest replied
    Re: Floating point computations differ in different runs of same program

    "Rahul" <rahulsharma@lu cent.comwrote in message news:1209312c-0031-4a44-9ccb-bf02e3cfe680@s1 9g2000prg.googl egroups.com...
    Hi,

    I have a C program which does lots of computations in floats and
    doubles,
    It is processing the same file (same data) but in different runs of
    the program (on the same machine) the results vary sometimes by
    numeric value 1 (which is after rounding the resulting float number)
    Is this expected behavior with floats and doulbe (with lots of
    intermediate conversion in between) ?

    Since There is only one thread so I guess the result should be same
    always.

    Any reason/pointers for the above mentioned behavior.
    Possible causes are:
    + Use of uninitialized variables.
    + Use of a random generator.
    + Use of the changing environment, e.g. the current time.
    + ...

    Leave a comment:


  • Lionel B
    Guest replied
    Re: Floating point computations differ in different runs of sameprogram

    On Thu, 14 Feb 2008 01:17:12 -0800, Rahul wrote:
    Hi,
    >
    I have a C program
    Um... so why are you posting to a C++ newsgroup?
    which does lots of computations in floats and doubles,
    It is processing the same file (same data) but in different runs of the
    program (on the same machine) the results vary sometimes by numeric
    value 1 (which is after rounding the resulting float number) Is this
    expected behavior with floats and doulbe (with lots of intermediate
    conversion in between) ?
    >
    Since There is only one thread so I guess the result should be same
    always.
    >
    Any reason/pointers for the above mentioned behavior.
    Sure there's no (pseudo)-random number generation going on?

    You'll probably have to post some (minimal) code that demonstrates the
    problem to sort this out... but comp.lang.c might be a better bet.

    --
    Lionel B

    Leave a comment:


  • Floating point computations differ in different runs of same program

    Hi,

    I have a C program which does lots of computations in floats and
    doubles,
    It is processing the same file (same data) but in different runs of
    the program (on the same machine) the results vary sometimes by
    numeric value 1 (which is after rounding the resulting float number)
    Is this expected behavior with floats and doulbe (with lots of
    intermediate conversion in between) ?

    Since There is only one thread so I guess the result should be same
    always.

    Any reason/pointers for the above mentioned behavior.

    Thanks in advance
    Rahul
Working...