Announcement

Collapse
No announcement yet.

How do I get full extended precision value?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #21
    Why not use a multi-precision program?

    I have U-BASIC but it is for DOS.

    There are a number of programs. Most are written in C++ and some in FORTRAN 90. I remember a SUN computer having quadruple precision (128 bits with: 112 for fraction and 15 for exponent).

    I tried to implement routines published for DOUBLE-DOUBLE but I got strange results. I tried to do Kahan sum routine and found the same trouble. DOUBLE-DOUBLE runs faster than multiprecision methods. I also looked into QUAD-DOUBLE but gave up because of the above problems.

    There are packages that use DOUBLE-DOUBLE internally to do linear algebra and get better results. I was trying to do least squares fit for 20 degree polynomial. The problem is known to have an ill-conditioned matrix. Higher precision would help.

    I resorted to storing extended result to string and picking out the 15 digits for double and then taking two 15 digit numbers, spliting each of them and multiplying to get 30 digit result. I also resorted to storing a string with 30 digits and spliting it up into integers and doing math with those. They require housekeeping to work. These routines are more proof of concept.

    I used a very crude way of getting the various parts of a floating-point number. That is why I asked the question.

    Comment


    • #22
      00
      Last edited by Bob Zale; 19 May 2008, 11:16 AM.

      Comment


      • #23
        Originally posted by Tom Ulrich View Post
        .... a multi-precision program? .....Higher precision would help.
        Patience, my friends... Arbitrary precision math is on the way...
        At this moment, I have +, -, *, / but there is more to come ...

        Kind regards
        Last edited by Eddy Van Esch; 16 May 2008, 07:33 PM.
        Eddy

        Comment


        • #24
          Yet another member of this community wrote a factorial function to handle gigantically huge numerical data types....
          Would that be the demo I wrote, available from my website at...
          http://www.talsystems.com/tsihome_ht...ads/Factor.zip
          .. to do up to 100 factorial, easily exandable?
          . There is no guarantee that any digit beyond position 18 is accurate
          Oh, I guess not, because I *do* guarantee the accuracy of that code.

          MCM
          Michael Mattias
          Tal Systems Inc. (retired)
          Racine WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #25
            000
            Last edited by Ion Saliu; 19 May 2008, 10:53 AM.

            Comment


            • #26
              0000
              Last edited by Ion Saliu; 19 May 2008, 10:53 AM.

              Comment


              • #27
                Floating point allows us to scale and approximate extremely large or extremely small numbers. By approximation, I mean that you cannot exactly represent a value like 1/3rd or 1/10th in binary form. Heck, you can't even represent 1/3rd exactly in base 10, as it would be written as 0.3333333333333333333333333333333333333333 ... to an infinite number of places.

                Eighteen or nineteen decimal places of accuracy is generally pretty good, and it keeps our representation down to just ten bytes. But if you need perfect accuracy, you probably need to consider big integer or huge integer math packages. These essentially use strings to represent arbitrary length integers, which then can be processed against each other. Fractions are like integers, only with the decimal point shifted far to the right, So technically, these packages can be used to process just about anything where the values and results come in at under 2 Gigabytes. But this type of processing is labor intensive on the part of the PC, so depending on what you are trying to do, the processing can take awhile.

                Comment


                • #28
                  00000
                  Last edited by Ion Saliu; 19 May 2008, 10:54 AM.

                  Comment


                  • #29
                    hmmm...

                    Currency data type offers 18 and a fraction digits. Not 300. Sorry...

                    Bob Zale
                    PowerBASIC Inc.

                    Comment


                    • #30
                      Originally posted by Ion Saliu View Post
                      Visual Basic has a data type named CURRENCY. It is 300 digits wide
                      Never encountered; I'm unable to find info on a VB6's datatype with this range.
                      Can you provide a link?

                      Thanks,
                      Bye!
                      -- The universe tends toward maximum irony. Don't push it.

                      File Extension Seeker - Metasearch engine for file extensions / file types
                      Online TrID file identifier | TrIDLib - Identify thousands of file formats

                      Comment


                      • #31
                        >>You cannot get a quart from a pint pot
                        >Unless the quart pot has been mis-labelled as a pint?

                        C'mon, Paul. By now you should know my view of using undocumented features.
                        Michael Mattias
                        Tal Systems Inc. (retired)
                        Racine WI USA
                        [email protected]
                        http://www.talsystems.com

                        Comment


                        • #32
                          000000
                          Last edited by Ion Saliu; 19 May 2008, 10:54 AM.

                          Comment


                          • #33
                            Unfortunately, you are confusing the range of values with the number of digits of accuracy. Actually, the range of a double is over 600 digits, but the only significant digits are the first 16. That's because every floating point number is made up of a mantissa and an exponent, and are, by definition, an approximation.

                            Best regards,
                            Bob Zale

                            Comment


                            • #34
                              Some people are so confused that they would do anything, like blindly using so-called huge math libraries....
                              ...and some are so confused they can't tell the difference between range and precison.
                              Michael Mattias
                              Tal Systems Inc. (retired)
                              Racine WI USA
                              [email protected]
                              http://www.talsystems.com

                              Comment


                              • #35
                                0000000
                                Last edited by Ion Saliu; 19 May 2008, 10:55 AM.

                                Comment


                                • #36
                                  Originally posted by Ion Saliu View Post
                                  It ain’t validated by a trustworthy third party entity, is it?
                                  Yes. It is certified by The Robert of Venice.

                                  Best regards,

                                  Bob Zale
                                  PowerBASIC Inc.

                                  Comment


                                  • #37
                                    Microsoft does NOT warn that “the only significant digits are the first 16”! Man, Microsoft is liable now! NOT! They would have been gone under long ago…at least since the release of VB6 and Visual Studio 6! What’s the purpose of showing 324 digits of negative numbers and 308 digits of positive numbers, IF they are zero after position 16? Who needs zeros?
                                    They should have warned. A Microsoft "double" is exactly the same thing as a PB "double". There are not 300 plus digits. There is nothing after position 16, not even zeros. You are confusing floating point with fixed point. When converting floating point to fixed point, zeros are needed to fill the space between the last significant digit and the decimal point.

                                    A "double" is 64 bits. If you can describe a 300 digit signed number within 64 bits, you should be designing FPUs for Intel. Until you can, please go study math and stop "flaming" the forum with nonsense.
                                    Dale

                                    Comment


                                    • #38
                                      >..The Robert of Venice

                                      And here I thought your sense of humor had left the building in 1994.
                                      Michael Mattias
                                      Tal Systems Inc. (retired)
                                      Racine WI USA
                                      [email protected]
                                      http://www.talsystems.com

                                      Comment

                                      Working...
                                      X