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 913675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:35:57+00:00 2026-05-15T17:35:57+00:00

2^64 is still far from the infinity my ram/hard drive can handle… First I

  • 0

2^64 is still far from the “infinity” my ram/hard drive can handle…

First I wonder how GMP works with memory/processor since it does some kind of shady optimisations…

I was also wondering if there is a way of storing an integer (unsigned, it’s easier) on an arbitrary number of bytes. For example, on 50 bytes, I would have a cap of 2^400 -1.
The thing to do is to work well with carries to keep the number consistent from one byte to another, I have some idea about that, but I’m really not sure it would be the fastest way to do this. I’m not even sure if I’m right.

I’m guessing GMP uses this kind of way to store its data, but I just want some (even little) explanation or some forwarding to some theory (I don’t have any doctorate, so don’t be tough).

  • 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-15T17:35:58+00:00Added an answer on May 15, 2026 at 5:35 pm

    GMP dynamically allocates space to represent numbers (and reallocates when it needs to grow).

    This is described in light detail in Integer Internals, in the GMP manual, it describes how it chunks up the representation into “limbs” and stores the limbs in an array.

    The description of the term “limbs” comes from GMP Basics: Nomenclature and Types:

    A limb means the part of a multi-precision number that fits in a single word. (We chose this word because a limb of the human body is analogous to a digit, only larger, and containing several digits.) Normally a limb contains 32 or 64 bits. The C data type for a limb is mp_limb_t.

    So, representing a number in GMP works by grouping a number of limbs together to represent the magnitude of the integer, stored with a sign bit (the sign bit is dual purposed to store the number of limbs).

    What does this mean to you? Well, normally an int64 is represented in 64 bits. Done. If you package a bunch of these together, you can significantly increase that. Put two together, 2^64*2^64, or 2^128. Add two more limbs and you get 2^256. That’s a lot of numbers, stored in 4 words (plus the representation overhead).

    Of course, the representation of floats is more complicated (see here), storing the representation using a mantissa (consisting of a sign and magnitude) and an exponent.

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

Sidebar

Related Questions

As far as I understand from the documentation the QUdpSocket are async but, still,
So far I can understand HTML.ActionLink and URL.RouteURL but still trying to absorb where
Still learning magento coding. I wonder is there a way I can print out
Although my site is still far from done, I've started thinking about web security.
I have used regExp quit a bit of times but still far from being
I am still far away from mastering C#, but the child in me is
Still having issues with this problem. Please help if you can. So I am
I'm sorry for yet another of these posts, but from what I can tell,
I have been struggling with this issue for one week, and still far away
After reading through various tutorials [1] I still can't get my VirtualHost settings to

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.