-1.#ind00

This is a discussion on -1.#ind00 within the C Programming forums, part of the General Programming Boards category; What does -1.#IND00 mean??...

  1. #1
    Unregistered
    Guest

    -1.#ind00

    What does -1.#IND00 mean??

  2. #2
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220
    It's Japanese for "I am a very large dinosaur with fourteen eyes"

  3. #3
    Unregistered
    Guest

    Unhappy

    OK then what does that have to do with the sin() function in math.h? I think that's what's causing the error.

  4. #4
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220
    sins are bad, god forgives you if you beg forgivness.

  5. #5
    Unregistered
    Guest

    Smile

    Thanks for the humor. It helps to be able to laugh even though you have 12 hours to finish 4 programs, and you've only had 1 class. UGHHHHH

  6. #6
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    What is that? is it an error code that's produced or what?

    Post some code.....

  7. #7
    Unregistered
    Guest
    OK.....

    #include <stdio.h>
    #include <math.h>

    #define PI 3.141592654

    double Foward(double x, double h);
    double Central(double x, double h);


    void main()
    {
    double x, h, fxF, fxC;
    x=1;

    h=1/4;
    fxF=Foward(x,h);

    printf("The value of F prime of 1 using the foward difference formula is %lf \n\n", fxF);

    fxC=Central(x,h);

    printf("The value of F prime of 1 using the central difference formula is %lf\n\n", fxC);


    }



    double Foward(double x, double h)
    {
    double x0, h0, fx, fxh, fprime;
    x0=x;
    h0=h;

    fx=sin(PI*x0);
    fxh=sin(PI*(x0+h0));


    fprime=(fxh-fx)/h;

    return fprime;
    }

    double Central(double x, double h)
    {

    double fprime, x0, h0, fxh1, fxh2;
    x0=x;
    h0=h;

    fxh1=sin(PI*(x0+h0));
    fxh2=sin(PI*(x0-h0));


    fprime=(fxh1-fxh2)/(2*h);

    return fprime;

    }










    This produces

    The value of F prime of 1 using the foward difference formula is
    -1.#IND00

    The value of F prime of 1 using the central difference formula is
    -1.#IND00


    Any suggestions about the bug?

  8. #8
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220
    I have no idea about the bug, but use INT MAIN! (I formatted the code so people who can help have an easier time)

    Code:
    #include <stdio.h> 
    #include <math.h> 
    
    #define PI 3.141592654 
    
    double Foward(double x, double h); 
    double Central(double x, double h); 
    
    
    int main(void) 
    { 
     double x, h, fxF, fxC; 
     x=1; 
     h=1/4; 
     fxF=Foward(x,h); 
     printf("The value of F prime of 1 using the foward difference formula is %lf \n\n", fxF); 
     fxC=Central(x,h); 
     printf("The value of F prime of 1 using the central difference formula is %lf\n\n", fxC); 
     return 0;
    } 
    
    
    
    double Foward(double x, double h) 
    { 
     double x0, h0, fx, fxh, fprime; 
     x0=x; 
     h0=h; 
     fx=sin(PI*x0); 
     fxh=sin(PI*(x0+h0)); 
     fprime=(fxh-fx)/h; 
     return fprime; 
    } 
    
    double Central(double x, double h) 
    { 
     double fprime, x0, h0, fxh1, fxh2; 
     x0=x; 
     h0=h; 
     fxh1=sin(PI*(x0+h0)); 
     fxh2=sin(PI*(x0-h0)); 
     fprime=(fxh1-fxh2)/(2*h); 
     return fprime; 
    }
    Last edited by Brian; 02-18-2002 at 04:52 PM.

  9. #9
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    I dont know exactly what you are doing, but if you substitute

    h=1/4;

    for

    h=(double)1/4;

    ...it seems happier....

    Still I dont know if the answers given are correct....

  10. #10
    Unregistered
    Guest

    Talking

    OH Yea!!! That actually solved the problem!! Thank you so much.

  11. #11
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,452
    > h=1/4;
    Which would be performed using integer math, giving you the result of 0 (due to truncation), and no doubt the subsequent use of zero was causing grief (perhaps divide by 0)

    http://homepages.borland.com/efg2lab...matics/NaN.htm

    > What does -1.#IND00 mean??
    About the same as #NAN
    http://www.cprogramming.com/cboard/s...threadid=11255

    I think it means INDefinite (which might also mean denormalised - see the other link)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading File Issue
    By dr0be in forum C Programming
    Replies: 23
    Last Post: 05-06-2007, 09:41 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21