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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:47:28+00:00 2026-05-22T22:47:28+00:00

This probably has probably been asked before, but I couldn’t find anything relevant. Would

  • 0

This probably has probably been asked before, but I couldn’t find anything relevant.

Would it be possible/performant to implement a kind of arbitrary/decimal arithmatic through a specialized class or struct of an arbitrary/fixed amount of integers?

Let me clarify; floats (as I understand them), use a mantissa, exponent and perhaps a sign bit. They are capable of representing 1/2, 1/4, 1/8, etc… but not, say 1/10.

What I propose is something like this: let the number be represented by a plain int or int64_t or a series of these, keeping only the values up to a power of ten completely covered by the range of the integer (so for a 32-bit int, the limit would be 10^8-1). This only to keep calculation easy. Add to that an exponent, that will say what power of ten it should be multiplied to get the real number.

An example: 125.36 would be represented by an int equal to 12536 and a power of ten equal to -2. This number would in effect take as much as too ints, and a bunch of special functions.

Another example: 4,294,967,297 (which is 2^32+1) would take two ints, one equal to 4, the other equal to 294,967,297, and a power of ten equal to 0.

Is this a good idea, throwing away all this memory for a simpler/faster arithmetic? I haven’t quite thought out the overflow part, perhaps calculating int32_t+int32_t=int64_t would solve that beautifully?

  • 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-22T22:47:28+00:00Added an answer on May 22, 2026 at 10:47 pm

    See the General Decimal Arithmetic page

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

Sidebar

Related Questions

This has probably been asked before but I can't find any relevant post using
This is probably a question that has been asked before, but I couldn't find
This has probably been asked before, but I couldn't find it. Is there a
This has probably been asked before, but I can't find a good way of
This has probably been asked before but I can't find it anywhere. I have
I know this has probably been asked before but I can't seem to find
I'm sure this has been asked before, but I can't find it. What are
This has probably been asked before, but a quick search only brought up the
This probably has been asked many times before but I was wondering how to
You're probably thinking this has been asked a million times before but I think

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.