floating point calculation problem

Discussion in 'C++' started by bei, Jan 6, 2010.

  1. bei

    bei Guest

    Hello,

    I was bothered by the following problem for a while and could not
    understand how it happened.

    Basically, i am doing an interpolation from a random position to the
    closest grid point position. They are a lot of
    floating point calculation in the code. Below is a part of the code
    that resulted in large errors:


    q0 = 1.0-2.5*pow(((v/dv+(N-0.5))-j0), 2.0)+1.5*pow(((v/dv+(N-0.5))-
    j0), 3.0);
     
    bei, Jan 6, 2010
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. H aka N
    Replies:
    15
    Views:
    16,839
    Ben Jones
    Mar 2, 2006
  2. Motaz Saad
    Replies:
    7
    Views:
    6,842
  3. Vinoth

    Floating point calculation

    Vinoth, May 19, 2005, in forum: C Programming
    Replies:
    7
    Views:
    639
  4. bei
    Replies:
    4
    Views:
    575
  5. Saraswati lakki
    Replies:
    0
    Views:
    1,691
    Saraswati lakki
    Jan 6, 2012
  6. teeshift
    Replies:
    2
    Views:
    526
    Chris Pearl
    Dec 1, 2006
  7. Hyun chul Park

    Floating point calculation problem

    Hyun chul Park, Jul 8, 2008, in forum: Ruby
    Replies:
    3
    Views:
    215
    Axel Etzold
    Jul 8, 2008
  8. Chris Angelico

    Re: Floating point calculation problem

    Chris Angelico, Feb 2, 2013, in forum: Python
    Replies:
    16
    Views:
    413
    Michael Torrie
    Feb 3, 2013
Loading...