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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:35:37+00:00 2026-05-22T11:35:37+00:00

I am adding a series of 8196 64-bit unsigned integers, and I need the

  • 0

I am adding a series of 8196 64-bit unsigned integers, and I need the running-total to “roll-over” back to zero and continue counting from there… just as a “normal” programing language would do at the relevent INT_MAX ceiling.

As the test script shows, adding 1 to an boundary value (FF, FFFF, etc) just keeps on increasing the total. A feature, no doubt, but I’d like to limit it to 64-bits for this particular instance..

Is there some way to limit bc in this?

unset f 
for ((i=0; i<8; i++)); do 
  f=${f}FF; echo -ne "$((${#f}/2)) bytes + 1      " 
  echo 'ibase=16; obase=10; ('$f'+1)' |bc 
done
echo "I want 8th+1 to = 0000000000000000"

# output
#
# 1 bytes + 1      100
# 2 bytes + 1      10000
# 3 bytes + 1      1000000
# 4 bytes + 1      100000000
# 5 bytes + 1      10000000000
# 6 bytes + 1      1000000000000
# 7 bytes + 1      100000000000000
# 8 bytes + 1      10000000000000000
# I want 8th+1 to = 0000000000000000
  • 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-22T11:35:38+00:00Added an answer on May 22, 2026 at 11:35 am

    This is called a modulo and you can read https://superuser.com/questions/31445/gnu-bc-modulo-with-scale-other-than-0 here about modulo and bc.

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

Sidebar

Related Questions

In my program I need to display a JFreeChart. I'm adding, over time, series
I'm adding a series of buttons to a UINavigationBar using: NSArray *items; items =
I am adding a series of records (eg 100) per single transaction. I want
Adding Multiple series to the ComboChart with different graph types is straightforward, but I
I need to fill in the gaps of a time series of a mysql
When running the following query in psql I get back 7 results: SELECT generate_series('2012-10-14',
I'm using EF4. I'm adding a series of new entities from a list of
I need to move a series of tables from one datasource to another. Our
I am adding a series of custom views to a LinearLayout. I have overridden
I am adding series and panes to a Developer's Express Chart Control in code

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.