Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 395529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:27:47+00:00 2026-05-12T16:27:47+00:00

I introduced myself to the GMP library for high precision arithmetic recently. It seems

  • 0

I introduced myself to the GMP library for high precision arithmetic recently. It seems easy enough to use but in my first program I am running into practical problems. How are expressions to be evaluated. For instance, if I have “1+8*z^2” and z is a mpz_t “large integer” variable, how am I to quickly evaluate this? (I have larger expressions in the program that I am writing.) Currently, I am doing every single operation manually and storing the results in temporary variables like this for the “1+8*z^2” expression:

1) first do mpt_mul(z,z,z) to square z

2) then define an mpz_t variable called “eight” with the value 8.

3) multiply the result from step one by this 8 and store in temp variable.

4) define mpz_t variable called “one” with value 1.

5) add this to the result in step 3 to find final answer.

Is this what I am supposed to be doing? Or is there a better way? It would really help if there was a user’s manual for GMP to get people started but there’s only the reference manual.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T16:27:47+00:00Added an answer on May 12, 2026 at 4:27 pm

    GMP comes with a C++ class interface which provides a more straightforward way of expressing arithmetic expressions. This interface uses C++ operator overloading to allow you to write:

    mpz_class z;
    1 + 8 * z**2
    

    This is, of course, assuming you’re using C++. If you are using C only, you may need to use the C interface to GMP which does not provide operator overloading.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is an easy program to introduce the Reactive Framework . But I want
I'm trying to make myself a GUI library using plain WinAPI. But I found
Vista introduced tags for the files. But how to extract these tags, let's say
Apple introduced Grand Central Dispatch (a thread pool) in Snow Leopard, but haven't gone
Facebook recently introduced the Built-in Like as a built-in Open Graph action (see blogpost
i've started to introduce myself into REST. I use as REST-framework Restlet. I have
I'm developing in LAMP (Linux+Apache+MySQL+PHP) since I remember myself. But one question was bugging
It seems that many of the JavaScript questions are answered by the simple use
std::atomic is new feature introduced by c++11 but I can't find much tutorial on
I have been recently introduced to the concept of BDD and am using SpecFlow

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.