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. error -1.#IND00 in vc++2010

error -1.#IND00 in vc++2010

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++help
7 Posts 3 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.
  • Y Offline
    Y Offline
    yahya77
    wrote on last edited by
    #1

    hello; I tried to write a function that calculates the harmonic average as follows:

    long double Harmonique(long double *t,int l)
    {
    long double s=0.0;
    for(int i=0;i

    the console I have this error -1.#IND00 .
    what is the origin of this error ?
    cordialy

    C T 4 Replies Last reply
    0
    • Y yahya77

      hello; I tried to write a function that calculates the harmonic average as follows:

      long double Harmonique(long double *t,int l)
      {
      long double s=0.0;
      for(int i=0;i

      the console I have this error -1.#IND00 .
      what is the origin of this error ?
      cordialy

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      what are the values of 'l' and 's', when you hit this line:

      return l/s;

      image processing toolkits | batch image processing

      1 Reply Last reply
      0
      • Y yahya77

        hello; I tried to write a function that calculates the harmonic average as follows:

        long double Harmonique(long double *t,int l)
        {
        long double s=0.0;
        for(int i=0;i

        the console I have this error -1.#IND00 .
        what is the origin of this error ?
        cordialy

        T Offline
        T Offline
        Thong LeTrung
        wrote on last edited by
        #3

        I think you should check address of pointer and length of array

        1 Reply Last reply
        0
        • Y yahya77

          hello; I tried to write a function that calculates the harmonic average as follows:

          long double Harmonique(long double *t,int l)
          {
          long double s=0.0;
          for(int i=0;i

          the console I have this error -1.#IND00 .
          what is the origin of this error ?
          cordialy

          T Offline
          T Offline
          Thong LeTrung
          wrote on last edited by
          #4

          I have checked on visual studio 2010 , you can check again

          #include
          #include
          using namespace std;

          long double Harmonique(long double *t,int l)
          {
          long double s=0.0;
          for(int i=0; i

          3.19262
          Press any key to continue . . .

          Thanks
          Thong Le Trung

          Y 1 Reply Last reply
          0
          • Y yahya77

            hello; I tried to write a function that calculates the harmonic average as follows:

            long double Harmonique(long double *t,int l)
            {
            long double s=0.0;
            for(int i=0;i

            the console I have this error -1.#IND00 .
            what is the origin of this error ?
            cordialy

            T Offline
            T Offline
            Thong LeTrung
            wrote on last edited by
            #5

            I am sorry , I see error for you . I have a example , i hope this example will help you. What will be output of the following program?

            #include
            int main(){
            float a=0.7;d
            if(a<0.7){
            printf("C");
            }
            else{
            printf("C++");
            }
            return 0;
            }

            EXPLANATION Output: Turbo C++ 3.0: c Turbo C ++4.5: c Linux GCC: c Visual C++: c Explanation: 0.7 is double constant (Default). Its binary value is written in 64 bit. Binary value of 0.7 = (0.1011 0011 0011 0011 0011 0011 0011 0011 0011 0011 0011 ) Now here variable a is a floating point variable while 0.7 is double constant. So variable a will contain only 32 bit value i.e. a = 0.1011 0011 0011 0011 0011 0011 0011 0011 while 0.7 = 0.1011 0011 0011 0011 0011 0011 0011 0011 0011 0011 0011.... It is obvious a < 0.7

            Y 1 Reply Last reply
            0
            • T Thong LeTrung

              I have checked on visual studio 2010 , you can check again

              #include
              #include
              using namespace std;

              long double Harmonique(long double *t,int l)
              {
              long double s=0.0;
              for(int i=0; i

              3.19262
              Press any key to continue . . .

              Thanks
              Thong Le Trung

              Y Offline
              Y Offline
              yahya77
              wrote on last edited by
              #6

              Here, I found the solution. the * t I used in "main" was of type int, so there was a problem of division by zero. thank you for example and help.

              1 Reply Last reply
              0
              • T Thong LeTrung

                I am sorry , I see error for you . I have a example , i hope this example will help you. What will be output of the following program?

                #include
                int main(){
                float a=0.7;d
                if(a<0.7){
                printf("C");
                }
                else{
                printf("C++");
                }
                return 0;
                }

                EXPLANATION Output: Turbo C++ 3.0: c Turbo C ++4.5: c Linux GCC: c Visual C++: c Explanation: 0.7 is double constant (Default). Its binary value is written in 64 bit. Binary value of 0.7 = (0.1011 0011 0011 0011 0011 0011 0011 0011 0011 0011 0011 ) Now here variable a is a floating point variable while 0.7 is double constant. So variable a will contain only 32 bit value i.e. a = 0.1011 0011 0011 0011 0011 0011 0011 0011 while 0.7 = 0.1011 0011 0011 0011 0011 0011 0011 0011 0011 0011 0011.... It is obvious a < 0.7

                Y Offline
                Y Offline
                yahya77
                wrote on last edited by
                #7

                now it's clear. thinks

                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