GMP Library and POWER

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • calimero22@freemail.it

    #1

    GMP Library and POWER

    Hi
    I'musing the GMP Libraries Mathematics.

    I need to calculate 123456789876543 21.123456787655 4456 ^
    987654321234455 6676.676767676

    How can i do ?
    The two variables are type MPF.
    Thanks
  • Keith Thompson

    #2
    Re: GMP Library and POWER

    calimero22@free mail.it writes:
    I'musing the GMP Libraries Mathematics.
    >
    I need to calculate 123456789876543 21.123456787655 4456 ^
    987654321234455 6676.676767676
    >
    How can i do ?
    The two variables are type MPF.
    Your question isn't about the C language.

    I'm sure GMP includes extensive documentation. Did it not answer your
    question?

    --
    Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

    Comment

    • calimero22@freemail.it

      #3
      Re: GMP Library and POWER

      On 30 Set, 19:27, Keith Thompson <ks...@mib.orgw rote:
      calimer...@free mail.it writes:
      I'musing the GMP Libraries Mathematics.
      >
      I need to calculate  123456789876543 21.123456787655 4456  ^
      987654321234455 6676.676767676
      >
      How can i do ?
      The two variables are type MPF.
      >
      Your question isn't about the C language.
      >
      I'm sure GMP includes extensive documentation.  Did it not answer your
      question?
      >
      --
      Keith Thompson (The_Other_Keit h) ks...@mib.org  <http://www.ghoti.net/~kst>
      Nokia
      "We must do something.  This is something.  Therefore, we must do this."
          -- Antony Jay and Jonathan Lynn, "Yes Minister"




      Ok. scuse me.
      The documentation doesn't report then solution.
      Thanks adn Scuse me.

      Comment

      • jameskuyper@verizon.net

        #4
        Re: GMP Library and POWER

        calimer...@free mail.it wrote:
        Hi
        I'musing the GMP Libraries Mathematics.
        >
        I need to calculate 123456789876543 21.123456787655 4456 ^
        987654321234455 6676.676767676
        >
        How can i do ?
        The two variables are type MPF
        The GMP libraries are off-topic in this group, and I know nothing
        about them. However, I would like to ask you about the problem you
        want to solve. There's strong hints that the numbers you've given are
        just examples. However, your example indicates that you want to raise
        a fairly large number with LOTS of significant digits to the power of
        another very large number which also has LOTS of significant digits.
        If the required number of significant digits in the answer must be
        comparable, then this is an exceedingly difficult problem. I consider
        it extremely unlikely (but admittedly not impossible) that you
        actually have a good reason for performing this calculation. Could you
        please explain why you want to calculate it? I strongly suspect
        someone will be able to point out a way to rearrange your question so
        that the information you really need can be found out much more
        accurately than the answer to your original question.

        Comment

        • calimero22@freemail.it

          #5
          Re: GMP Library and POWER

          On 30 Set, 19:36, jameskuy...@ver izon.net wrote:
          calimer...@free mail.it wrote:
          Hi
          I'musing the GMP Libraries Mathematics.
          >
          I need to calculate  123456789876543 21.123456787655 4456  ^
          987654321234455 6676.676767676
          >
          How can i do ?
          The two variables are type MPF
          >
          The GMP libraries are off-topic in this group, and I know nothing
          about them. However, I would like to ask you about the problem you
          want to solve. There's strong hints that the numbers you've given are
          just examples. However, your example indicates that you want to raise
          a fairly large number with LOTS of significant digits to the power of
          another very large number which also has LOTS of significant digits.
          If the required number of significant digits in the answer must be
          comparable, then this is an exceedingly difficult problem. I consider
          it extremely unlikely (but admittedly not impossible) that you
          actually have a good reason for performing this calculation. Could you
          please explain why you want to calculate it? I strongly suspect
          someone will be able to point out a way to rearrange your question so
          that the information you really need can be found out much more
          accurately than the answer to your original question.



          Exact
          i must find the logarithm and i need to calculate a great float number
          power to a great float number.
          Is there a discussion group about GMP library ?

          Thanks and scuse me again.
          Giovanni

          Comment

          • Eric Sosman

            #6
            Re: GMP Library and POWER

            calimero22@free mail.it wrote:
            Hi
            I'musing the GMP Libraries Mathematics.
            >
            I need to calculate 123456789876543 21.123456787655 4456 ^
            987654321234455 6676.676767676
            >
            How can i do ?
            The two variables are type MPF.
            As Keith Thompson points out, your question isn't about C but
            about the GMP product.

            He might also have pointed out that you don't have enough money
            to afford the answer (assuming you mean ^ to signify exponentiation) .
            The result will have about 1.6E20 decimal digits in the integer part
            alone, roughly 5.3E20 bits or 66E18 eight-bit bytes in ordinary
            positional notation. Sixty-six exabytes, or sixty-six thousand
            petabytes, or sixty-six million terabytes. I hope you've got plenty
            of RAM, and a machine able to address it all (note that a 64-bit
            address is too small).

            --
            Eric.Sosman@sun .com

            Comment

            • Flash Gordon

              #7
              Re: GMP Library and POWER

              calimero22@free mail.it wrote, On 30/09/08 19:01:
              On 30 Set, 19:36, jameskuy...@ver izon.net wrote:
              >calimer...@fre email.it wrote:
              >>Hi
              >>I'musing the GMP Libraries Mathematics.
              >>I need to calculate 123456789876543 21.123456787655 4456 ^
              >>9876543212344 556676.67676767 6
              >>How can i do ?
              >>The two variables are type MPF
              <snip reasons why this calculation is at least very difficult and
              probably not what is wanted>
              Exact
              i must find the logarithm
              Using a logarithm function woud probably be a better idea!
              and i need to calculate a great float number
              power to a great float number.
              Hmm. I suspect your algorithm needs some work.
              Is there a discussion group about GMP library ?
              Yes, and there are links to them on the GMP library web site! See

              --
              Flash Gordon
              If spamming me sent it to smap@spam.cause way.com
              If emailing me use my reply-to address
              See the comp.lang.c Wiki hosted by me at http://clc-wiki.net/

              Comment

              • Antoninus Twink

                #8
                Re: GMP Library and POWER

                On 30 Sep 2008 at 18:01, calimero22@free mail.it wrote:
                i must find the logarithm and i need to calculate a great float number
                power to a great float number.
                You can't do it out-of-the-box using GMP. For example, there's no way of
                calculating e to some floating-point power. You'll need to write your
                own exponential and logarithm functions using power series expansions or
                whatever your favorite numerical method is.
                Is there a discussion group about GMP library ?
                This is an excellent place to ask about GMP. You'll annoy the local
                grumps, who want to change the character of this group from a C group to
                an ISO-C group, but just ignore them - they'll refuse to give you any
                useful help anyway.

                Comment

                • Trent Josephsen

                  #9
                  Re: GMP Library and POWER

                  Eric Sosman wrote:
                  calimero22@free mail.it wrote:
                  >Hi
                  >I'musing the GMP Libraries Mathematics.
                  >>
                  >I need to calculate 123456789876543 21.123456787655 4456 ^
                  >98765432123445 56676.676767676
                  >>
                  >How can i do ?
                  >The two variables are type MPF.
                  >
                  As Keith Thompson points out, your question isn't about C but
                  about the GMP product.
                  >
                  He might also have pointed out that you don't have enough money
                  to afford the answer (assuming you mean ^ to signify exponentiation) .
                  The result will have about 1.6E20 decimal digits in the integer part
                  alone, roughly 5.3E20 bits or 66E18 eight-bit bytes in ordinary
                  positional notation. Sixty-six exabytes, or sixty-six thousand
                  petabytes, or sixty-six million terabytes. I hope you've got plenty
                  of RAM, and a machine able to address it all (note that a 64-bit
                  address is too small).
                  >
                  [OT]
                  Not to mention that if you can write two digits per second, it would
                  take about 252 billion years to write the answer out longhand!

                  You did mention the word "logarithm" . I presumed when I read it that
                  you meant "algorithm" , but if you only need to find a /logarithm/ of
                  such a number, i.e.

                  log(12345678987 654321.12345678 76554456 ** 987654321234455 6676.676767676)

                  where ** represents exponentiation, you want to multiply the exponent by
                  the logarithm of the base. That is,

                  log (b ** e) == e * log (b)

                  which makes it possible to calculate the logarithms of very large powers
                  of numbers without calculating the number itself.

                  Comment

                  • jameskuyper@verizon.net

                    #10
                    Re: GMP Library and POWER

                    calimer...@free mail.it wrote:
                    On 30 Set, 19:36, jameskuy...@ver izon.net wrote:
                    calimer...@free mail.it wrote:
                    Hi
                    I'musing the GMP Libraries Mathematics.
                    I need to calculate �123456789876 54321.123456787 6554456 �^
                    987654321234455 6676.676767676
                    How can i do ?
                    The two variables are type MPF
                    The GMP libraries are off-topic in this group, and I know nothing
                    about them. However, I would like to ask you about the problem you
                    want to solve. There's strong hints that the numbers you've given are
                    just examples. However, your example indicates that you want to raise
                    a fairly large number with LOTS of significant digits to the power of
                    another very large number which also has LOTS of significant digits.
                    If the required number of significant digits in the answer must be
                    comparable, then this is an exceedingly difficult problem. I consider
                    it extremely unlikely (but admittedly not impossible) that you
                    actually have a good reason for performing this calculation. Could you
                    please explain why you want to calculate it? I strongly suspect
                    someone will be able to point out a way to rearrange your question so
                    that the information you really need can be found out much more
                    accurately than the answer to your original question.
                    >
                    >
                    >
                    >
                    Exact
                    i must find the logarithm and i need to calculate a great float number
                    power to a great float number.
                    It's a lot easier to find the logarithm of that number than it is to
                    calculate the number itself. In C terms,

                    long double log_number = logl(1234567898 7654321.1234567 876554456L) *
                    987654321234455 6676.676767676L ;

                    I have no idea how to convert that into GMP terms.

                    You can even perform that calculation in C and get a fairly large
                    number of significant digits (though on a typical implementation even
                    long double won't have as many significant digits as you need.
                    Is there a discussion group about GMP library ?
                    Sorry, I don't know.

                    Comment

                    • Nick Keighley

                      #11
                      Re: GMP Library and POWER

                      On 30 Sep, 19:09, Eric Sosman <Eric.Sos...@su n.comwrote:
                      calimer...@free mail.it wrote:
                      Hi
                      I'musing the GMP Libraries Mathematics.
                      >
                      I need to calculate  123456789876543 21.123456787655 4456  ^
                      987654321234455 6676.676767676
                      >
                      How can i do ?
                      The two variables are type MPF.
                      >
                           As Keith Thompson points out, your question isn't about C but
                      about the GMP product.
                      >
                           He might also have pointed out that you don't have enough money
                      to afford the answer (assuming you mean ^ to signify exponentiation) .
                      The result will have about 1.6E20 decimal digits in the integer part
                      alone, roughly 5.3E20 bits or 66E18 eight-bit bytes in ordinary
                      positional notation.  Sixty-six exabytes, or sixty-six thousand
                      petabytes, or sixty-six million terabytes.  I hope you've got plenty
                      of RAM, and a machine able to address it all (note that a 64-bit
                      address is too small).
                      isn't it worse than that?

                      log(a ^ b) = log(a) * b

                      log(a) /= 16
                      log(a) * b /= 10^20

                      so log(a ^ b) has 20 decimal places...


                      (where log is log base 10, ^ is exponentiation
                      /= is approximatly)

                      I must have done something wrong here...

                      --
                      Nick Keighley



                      Comment

                      • Eric Sosman

                        #12
                        Re: GMP Library and POWER

                        Nick Keighley wrote:
                        On 30 Sep, 19:09, Eric Sosman <Eric.Sos...@su n.comwrote:
                        >calimer...@fre email.it wrote:
                        >>Hi
                        >>I'musing the GMP Libraries Mathematics.
                        >>I need to calculate 123456789876543 21.123456787655 4456 ^
                        >>9876543212344 556676.67676767 6
                        >>How can i do ?
                        >>The two variables are type MPF.
                        > As Keith Thompson points out, your question isn't about C but
                        >about the GMP product.
                        >>
                        > He might also have pointed out that you don't have enough money
                        >to afford the answer (assuming you mean ^ to signify exponentiation) .
                        >The result will have about 1.6E20 decimal digits in the integer part
                        >alone, roughly 5.3E20 bits or 66E18 eight-bit bytes in ordinary
                        >positional notation. Sixty-six exabytes, or sixty-six thousand
                        >petabytes, or sixty-six million terabytes. I hope you've got plenty
                        >of RAM, and a machine able to address it all (note that a 64-bit
                        >address is too small).
                        >
                        isn't it worse than that?
                        >
                        log(a ^ b) = log(a) * b
                        >
                        log(a) /= 16
                        log(a) * b /= 10^20
                        >
                        so log(a ^ b) has 20 decimal places...
                        >
                        >
                        (where log is log base 10, ^ is exponentiation
                        /= is approximatly)
                        >
                        I must have done something wrong here...
                        You wrote "log(a ^ b) has 20 decimal places," and I
                        wrote "the result will have about 1.6E20 decimal digits,"
                        so we're in good agreement. If you've done something wrong
                        here, then so have I ...

                        --
                        Eric Sosman
                        esosman@ieee-dot-org.invalid

                        Comment

                        • calimero22@freemail.it

                          #13
                          Re: GMP Library and POWER

                          On 1 Ott, 14:27, Eric Sosman <esos...@ieee-dot-org.invalidwrot e:
                          Nick Keighley wrote:
                          On 30 Sep, 19:09, Eric Sosman <Eric.Sos...@su n.comwrote:
                          calimer...@free mail.it wrote:
                          >Hi
                          >I'musing the GMP Libraries Mathematics.
                          >I need to calculate  123456789876543 21.123456787655 4456  ^
                          >98765432123445 56676.676767676
                          >How can i do ?
                          >The two variables are type MPF.
                               As Keith Thompson points out, your question isn't about C but
                          about the GMP product.
                          >
                               He might also have pointed out that you don't have enough money
                          to afford the answer (assuming you mean ^ to signify exponentiation) .
                          The result will have about 1.6E20 decimal digits in the integer part
                          alone, roughly 5.3E20 bits or 66E18 eight-bit bytes in ordinary
                          positional notation.  Sixty-six exabytes, or sixty-six thousand
                          petabytes, or sixty-six million terabytes.  I hope you've got plenty
                          of RAM, and a machine able to address it all (note that a 64-bit
                          address is too small).
                          >
                          isn't it worse than that?
                          >
                          log(a ^ b) = log(a) * b
                          >
                          log(a) /= 16
                          log(a) * b /= 10^20
                          >
                          so log(a ^ b) has 20 decimal places...
                          >
                          (where log is log base 10, ^ is exponentiation
                          /= is approximatly)
                          >
                          I must have done something wrong here...
                          >
                               You wrote "log(a ^ b) has 20 decimal places," and I
                          wrote "the result will have about 1.6E20 decimal digits,"
                          so we're in good agreement.  If you've done something wrong
                          here, then so have I ...
                          >
                          --
                          Eric Sosman
                          esos...@ieee-dot-org.invalid- Nascondi testo citato
                          >
                          - Mostra testo citato -



                          Thank you to all.

                          Comment

                          Working...