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. Working with huge Floating Point Numbers

Working with huge Floating Point Numbers

Scheduled Pinned Locked Moved C / C++ / MFC
c++comtutorialquestion
11 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.
  • S Offline
    S Offline
    Semion_N
    wrote on last edited by
    #1

    Hello, I need a class which I can work with a huge floating point numbers and make an operations with them like *-/+ for example: 122354554654549878987.003253265465454597 * 65465465456654564.3212154654 I need something like this http://www.codeproject.com/cpp/largenumber.asp[^] but with floating point numbers. Is there any class like I want?

    SnaidiS(Semion)

    N C 2 Replies Last reply
    0
    • S Semion_N

      Hello, I need a class which I can work with a huge floating point numbers and make an operations with them like *-/+ for example: 122354554654549878987.003253265465454597 * 65465465456654564.3212154654 I need something like this http://www.codeproject.com/cpp/largenumber.asp[^] but with floating point numbers. Is there any class like I want?

      SnaidiS(Semion)

      N Offline
      N Offline
      Newbie00
      wrote on last edited by
      #2

      Why won't you use long double type?

      1 Reply Last reply
      0
      • S Semion_N

        Hello, I need a class which I can work with a huge floating point numbers and make an operations with them like *-/+ for example: 122354554654549878987.003253265465454597 * 65465465456654564.3212154654 I need something like this http://www.codeproject.com/cpp/largenumber.asp[^] but with floating point numbers. Is there any class like I want?

        SnaidiS(Semion)

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

        a little Googling turns up a few high-precision floating point libs for C++.

        image processing toolkits | batch image processing | blogging

        S 1 Reply Last reply
        0
        • C Chris Losinger

          a little Googling turns up a few high-precision floating point libs for C++.

          image processing toolkits | batch image processing | blogging

          S Offline
          S Offline
          Semion_N
          wrote on last edited by
          #4

          do you think http://savannah.nongnu.org/projects/hpalib[^] will fulfill my requirements I mentioned?

          SnaidiS(Semion)

          C 1 Reply Last reply
          0
          • S Semion_N

            do you think http://savannah.nongnu.org/projects/hpalib[^] will fulfill my requirements I mentioned?

            SnaidiS(Semion)

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

            it says it can handle numbers in the range: 2^16384 > x > 2^[-16383] that's far greater than the numbers you gave in your post

            image processing toolkits | batch image processing | blogging

            S 1 Reply Last reply
            0
            • C Chris Losinger

              it says it can handle numbers in the range: 2^16384 > x > 2^[-16383] that's far greater than the numbers you gave in your post

              image processing toolkits | batch image processing | blogging

              S Offline
              S Offline
              Semion_N
              wrote on last edited by
              #6

              I have problems with the files. I added the src folder to the project like that: Tools->Options->Projects And Solutions->VC++ Directories-> and to included files and source files. I'll show you here the most important code: #include "stdafx.h" #include "num.h" #include "numDlg.h" #include "stdio.h" #include "xpre.h" BOOL CnumDlg::OnInitDialog() { CDialog::OnInitDialog(); CnumDlg::play(); return TRUE; // return TRUE unless you set the focus to a control } void CnumDlg::play() { struct xpr s; int i,n; s=xZero; do { scanf("%d",&n); s=xZero; for(i=0;i<=n;i++) s=xadd(s,xpr2(xOne,i),0); xprxpr(s,30); putchar('\n'); }while (n>0); } I earased the most of the code-just the important there. After I'm running the program I have the following Errors: 1>numDlg.obj : error LNK2019: unresolved external symbol _xprxpr referenced in function "public: void __thiscall CnumDlg::play(void)" (?play@CnumDlg@@QAEXXZ) 1>numDlg.obj : error LNK2019: unresolved external symbol _xadd referenced in function "public: void __thiscall CnumDlg::play(void)" (?play@CnumDlg@@QAEXXZ) 1>numDlg.obj : error LNK2019: unresolved external symbol _xpr2 referenced in function "public: void __thiscall CnumDlg::play(void)" (?play@CnumDlg@@QAEXXZ) 1>numDlg.obj : error LNK2001: unresolved external symbol _xOne 1>numDlg.obj : error LNK2001: unresolved external symbol _xZero 1>C:\Documents and Settings\Semion Naidis\My Documents\Visual Studio 2005\Projects\num\Debug\num.exe : fatal error LNK1120: 5 unresolved externals How can I fix that?

              SnaidiS(Semion)

              C 1 Reply Last reply
              0
              • S Semion_N

                I have problems with the files. I added the src folder to the project like that: Tools->Options->Projects And Solutions->VC++ Directories-> and to included files and source files. I'll show you here the most important code: #include "stdafx.h" #include "num.h" #include "numDlg.h" #include "stdio.h" #include "xpre.h" BOOL CnumDlg::OnInitDialog() { CDialog::OnInitDialog(); CnumDlg::play(); return TRUE; // return TRUE unless you set the focus to a control } void CnumDlg::play() { struct xpr s; int i,n; s=xZero; do { scanf("%d",&n); s=xZero; for(i=0;i<=n;i++) s=xadd(s,xpr2(xOne,i),0); xprxpr(s,30); putchar('\n'); }while (n>0); } I earased the most of the code-just the important there. After I'm running the program I have the following Errors: 1>numDlg.obj : error LNK2019: unresolved external symbol _xprxpr referenced in function "public: void __thiscall CnumDlg::play(void)" (?play@CnumDlg@@QAEXXZ) 1>numDlg.obj : error LNK2019: unresolved external symbol _xadd referenced in function "public: void __thiscall CnumDlg::play(void)" (?play@CnumDlg@@QAEXXZ) 1>numDlg.obj : error LNK2019: unresolved external symbol _xpr2 referenced in function "public: void __thiscall CnumDlg::play(void)" (?play@CnumDlg@@QAEXXZ) 1>numDlg.obj : error LNK2001: unresolved external symbol _xOne 1>numDlg.obj : error LNK2001: unresolved external symbol _xZero 1>C:\Documents and Settings\Semion Naidis\My Documents\Visual Studio 2005\Projects\num\Debug\num.exe : fatal error LNK1120: 5 unresolved externals How can I fix that?

                SnaidiS(Semion)

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

                you'll need to either provide definitions for those functions, or remove the calls to them.

                S 1 Reply Last reply
                0
                • C Chris Losinger

                  you'll need to either provide definitions for those functions, or remove the calls to them.

                  S Offline
                  S Offline
                  Semion_N
                  wrote on last edited by
                  #8

                  I gave a definitions for those functions here: // numDlg.h : header file // #include "xpre.h" #pragma once // CnumDlg dialog class CnumDlg : public CDialog { // Construction public: CnumDlg(CWnd* pParent = NULL); // standard constructor void CnumDlg::play(); _**struct xpr xadd (struct xpr a, struct xpr b, int k); struct xpr xpr2 (struct xpr s, int n); void xprxpr (struct xpr u, int m);**_ I have the almost the same problem... 1>numDlg.obj : error LNK2019: unresolved external symbol "public: void __thiscall CnumDlg::xprxpr(struct xpr,int)" (?xprxpr@CnumDlg@@QAEXUxpr@@H@Z) referenced in function "public: void __thiscall CnumDlg::play(void)" (?play@CnumDlg@@QAEXXZ) 1>numDlg.obj : error LNK2019: unresolved external symbol "public: struct xpr __thiscall CnumDlg::xadd(struct xpr,struct xpr,int)" (?xadd@CnumDlg@@QAE?AUxpr@@U2@0H@Z) referenced in function "public: void __thiscall CnumDlg::play(void)" (?play@CnumDlg@@QAEXXZ) 1>numDlg.obj : error LNK2019: unresolved external symbol "public: struct xpr __thiscall CnumDlg::xpr2(struct xpr,int)" (?xpr2@CnumDlg@@QAE?AUxpr@@U2@H@Z) referenced in function "public: void __thiscall CnumDlg::play(void)" (?play@CnumDlg@@QAEXXZ) 1>numDlg.obj : error LNK2001: unresolved external symbol _xOne And if I'm trying to define it the xZero and xOne too(extern const struct xpr xZero, xOne, xTwo, xTen;) I have the following errors: 1>c:\documents and settings\semion naidis\my documents\visual studio 2005\projects\num\num\numdlg.h(17) : error C2071: 'CnumDlg::xZero' : illegal storage class 1>c:\documents and settings\semion naidis\my documents\visual studio 2005\projects\num\num\numdlg.h(17) : error C2071: 'CnumDlg::xOne' : illegal storage class 1>c:\documents and settings\semion naidis\my documents\visual studio 2005\projects\num\num\numdlg.h(17) : error C2071: 'CnumDlg::xTwo' : illegal storage class 1>c:\documents and settings\semion naidis\my documents\visual studio 2005\projects\num\num\numdlg.h(17) : error C2071: 'CnumDlg::xTen' : illegal storage class What should I do?

                  SnaidiS(Semion)

                  C 1 Reply Last reply
                  0
                  • S Semion_N

                    I gave a definitions for those functions here: // numDlg.h : header file // #include "xpre.h" #pragma once // CnumDlg dialog class CnumDlg : public CDialog { // Construction public: CnumDlg(CWnd* pParent = NULL); // standard constructor void CnumDlg::play(); _**struct xpr xadd (struct xpr a, struct xpr b, int k); struct xpr xpr2 (struct xpr s, int n); void xprxpr (struct xpr u, int m);**_ I have the almost the same problem... 1>numDlg.obj : error LNK2019: unresolved external symbol "public: void __thiscall CnumDlg::xprxpr(struct xpr,int)" (?xprxpr@CnumDlg@@QAEXUxpr@@H@Z) referenced in function "public: void __thiscall CnumDlg::play(void)" (?play@CnumDlg@@QAEXXZ) 1>numDlg.obj : error LNK2019: unresolved external symbol "public: struct xpr __thiscall CnumDlg::xadd(struct xpr,struct xpr,int)" (?xadd@CnumDlg@@QAE?AUxpr@@U2@0H@Z) referenced in function "public: void __thiscall CnumDlg::play(void)" (?play@CnumDlg@@QAEXXZ) 1>numDlg.obj : error LNK2019: unresolved external symbol "public: struct xpr __thiscall CnumDlg::xpr2(struct xpr,int)" (?xpr2@CnumDlg@@QAE?AUxpr@@U2@H@Z) referenced in function "public: void __thiscall CnumDlg::play(void)" (?play@CnumDlg@@QAEXXZ) 1>numDlg.obj : error LNK2001: unresolved external symbol _xOne And if I'm trying to define it the xZero and xOne too(extern const struct xpr xZero, xOne, xTwo, xTen;) I have the following errors: 1>c:\documents and settings\semion naidis\my documents\visual studio 2005\projects\num\num\numdlg.h(17) : error C2071: 'CnumDlg::xZero' : illegal storage class 1>c:\documents and settings\semion naidis\my documents\visual studio 2005\projects\num\num\numdlg.h(17) : error C2071: 'CnumDlg::xOne' : illegal storage class 1>c:\documents and settings\semion naidis\my documents\visual studio 2005\projects\num\num\numdlg.h(17) : error C2071: 'CnumDlg::xTwo' : illegal storage class 1>c:\documents and settings\semion naidis\my documents\visual studio 2005\projects\num\num\numdlg.h(17) : error C2071: 'CnumDlg::xTen' : illegal storage class What should I do?

                    SnaidiS(Semion)

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

                    it's hard for me to say. i suggest you try to contact the authors of the class to see if they have any documentation that can help.

                    image processing toolkits | batch image processing | blogging

                    S 1 Reply Last reply
                    0
                    • C Chris Losinger

                      it's hard for me to say. i suggest you try to contact the authors of the class to see if they have any documentation that can help.

                      image processing toolkits | batch image processing | blogging

                      S Offline
                      S Offline
                      Semion_N
                      wrote on last edited by
                      #10

                      Maybe you have any other libraries like this one?

                      SnaidiS(Semion)

                      C 1 Reply Last reply
                      0
                      • S Semion_N

                        Maybe you have any other libraries like this one?

                        SnaidiS(Semion)

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

                        i don't have any libraries of this type. try Google.

                        image processing toolkits | batch image processing | blogging

                        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