Comments (19)
Can i recommend using uint64_t
from cstdint
, instead of unsigned long long?
unsigned long long is promised to be at least 64 bit but not certainly exactly 64.
I assume that could create some problems if you use calculations that assume base 2^64.
from bigint.
if you are implementing any feature then probably you should create a issue and then implement that particular feature like first create issue Implement sum of BigInts in vectorized implementation and then sumbit PR for that particular issue. This way different people can work on it
from bigint.
The idea of using numbers in base 2^64 seems interesting. But the representation you have used is quite opposite of what is used commonly i.e Leftmost digit is the most significant one and rightmost digit is the least significant. Is there any reason behind this choice?
from bigint.
@surajumang Since all arithmetic operations (except division) are done from right to left, it's simpler to store the right-most digit as the first digit in an array since it will be processed first. But this is just to make the code simpler. When written formally, the most significant digits are always written first, followed by less significant digits to the right.
from bigint.
I would like to work on this but think it will require a complete overhaul of the existing codebase like redefining all the arithmetic operations. What do you say?
from bigint.
@surajumang Yes, it would require a complete rewrite of all the arithmetic operators and a few other methods.
I'll be creating a new branch and will implement some basic stuff like converting from base 10 to base 264. Once that's done, I'll notify you and you can contribute to that branch.
from bigint.
@SingleJourney English please! Google Translate isn't perfect :)
from bigint.
Could you let me know when you've added that branch?
I would like to help contribute to the math functions using the new representation and anything else.
from bigint.
@surajumang @OmriHab I've added the branch base-2-to-the-64
. The changes made so far on this branch can be tracked by comparing the branch with master
.
from bigint.
Alternatively unsigned long long can be used and just take into consideration that it isn't necessarily 64 bit.
E.g the maximum would be numeric_limits<unsigned long long>::max()
instead of UINT_64_MAX
from bigint.
@OmriHab Good suggestion! I'll change the type to uint64_t
.
from bigint.
Is the issue still open? If it is, I will start working on it.
from bigint.
Hi, I see the issue as open but seeing as its been over a year I would like to touch base and ask what I should work on as I would like to help.
from bigint.
@DarkenedOrigins If you're interested in working on it then I would be glad to help you by reviewing the code and helping with the logic.
You can start by creating a draft PR in which you can implement a utility function that takes a string representation of an integer and converts it to its base 2βΆβ΄ integer vector representation.
If anyone else is interested in working on this too then they can contribute in the same PR.
from bigint.
Awesome, would you prefer that I create this in its own class called BigInt64 or i bolt it on to the current implementation
from bigint.
@DarkenedOrigins The existing class can be renamed to BigIntString
and then you can create a new BigInt
class.
from bigint.
inorder to be less destructive I made a new class called BigInt64. My implementation actually uses the string based BigInt internally. The only problem I had was difficulty in compiling since I have never used cmake before nor have I worked with such fragmented code where each implementation almost has its own file. Some help would be greatly appreciated.
from bigint.
inorder to be less destructive I made a new class called BigInt64
Good call! We can do the renaming later.
The only problem I had was difficulty in compiling [...]
Yeah, the documentation related to development is not very good at the moment. I'll add details regarding how and when to create a new header file, how to write tests for it, and how to compile and run the tests using CMake and CTest. If you need help on anything more specific, you can leave a comment in PR #58 that you opened and @mention me in it. I'll get back to you whenever I can.
from bigint.
use std:bitset<>
, long long
calculations are much slower than 2 int
s on some CPU.
from bigint.
Related Issues (20)
- sqrt returns incorrect result for inputs that are a perfect square HOT 1
- Build fails in CLion 2017.3 HOT 1
- Add support for hexadecimal string in constructor HOT 9
- Should is_valid_number be able to handle negative numbers? HOT 2
- big_random might return a BigInt having a value with a leading 0 HOT 4
- Hex support HOT 1
- `big_random` function: mistake in description and better implementation suggestion HOT 3
- Improve README
- sqrt() always returns 1 HOT 4
- Improve the documentation related to development
- Support bitwise operation HOT 12
- a bug in DIV HOT 1
- MacOS Invalid token in expression during Make HOT 1
- Cannot compile on msvc2019, cmake, when trying to compile the release 0.50 HOT 1
- Very slow compared to the GNU MP Bignum Library HOT 3
- BigInt problem with hexdigit string HOT 1
- `log()` support
- Elaborate instructions on which files to #include for which functions/operators HOT 2
- Fix for MSVC?
- Invalid string access on modulo
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bigint.