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

  • Home
  • SEARCH
  • 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 7405965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:29:03+00:00 2026-05-29T05:29:03+00:00

I will need to add two unsigned 256 megabit integers over two billion times.

  • 0

I will need to add two unsigned 256 megabit integers over two billion times. Since carrying is obviously very important in addition and cannot be determined without waiting for lower order bits to be added, are there any performance gains to be had from multicore CPU features, such as splitting the number into multiple parts and dealing with carries later?

  • 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-29T05:29:04+00:00Added an answer on May 29, 2026 at 5:29 am

    You can definitely separate this up into many pieces. For example, take these two numbers:

      12345
    + 67890
    

    Now we’ll split them after the third digit, between the hundreds and tens columns. This gives us

      123      45
    + 678    + 90
    

    Calculate the results of each

      123      45
    + 678    + 90
    -------------
      801     135
    

    On the left number set you need to know how many digits you chopped off, in this case, two digits, so add two zeros back onto the end of 801, giving you 80100. And add 135 to it, and you have 80235.

    You could do this with much larger numbers, and as many splits as you would like. Using this method prevents any carrying from occurring.

    Of course, when you recombine large numbers you’re still left with large additions. You could probably figure out how many digits have carried, and just add that small amount to your left-hand number.

    For instance, in our above example, our number on the right ended up going from 2 columns to 3 columns, with the result being 135. So the extra column is the number to be carried, which could be added to your 801. This allows you to add to the small number, and then just concatenate the two numbers like you would a string

    45 and 90 both took up two columns, which added made 135. We take any extra columns generated, in this case, just the 1, and add it to our left-hand number, 801.

    801 + 1 = 802   
    802 concatenated with 35 = 80235
    

    If you want something extremely efficient, I’m sure you could look-up how 32-bit processors add 64-bit or larger numbers. I’m sure they do something similar for 64-bit numbers, adding the two 32-bit sections, and carrying over from the least significant 32-bit to the most significant.

    And in terms of parallelization, split up your number into 32-bit pairs to be added together, then determine how many available threads the CPU can handle at once, and split up your list of pairs by that much and give that much to each thread. When the results are calculated, put them in a completed section.

    The trick of carrying the numbers from the least significant to the most significant once you get all the results back will be tricky, as adding even a single 1 value to a number can cause it roll over another number as well.

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

Sidebar

Related Questions

Using Your Ruby Gem(s) You will need to add /home/username/ruby/gems to the include path.
I need to add a shake feature that will refresh my Android application. All
I've a need to add method that will calculate a weighted sum of worker
Hi I need to extend the CListControl class in C++/MFC, which will add several
Specifically: I have two unsigned integers (a,b) and I want to calculate (a*b)%UINT_MAX (UINT_MAX
I'm building a Flex application that will need run under two different deployment scenarios:
I'm trying to add two image files into the solution, so they will be
I need to add two polynomials together using a recursive method. This is for
A simple question: I need to add some logging to my program. If two
I have some content in a database, but now I need to add two

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.