Comments (8)
Would I be able to work on this?
from bigint.
@KingAkeem Sure, go ahead!
from bigint.
I'm not sure how you want the multiply to be optimized, I attempted to just append zeros based on the size of the number but that's much slower than normal multiplication. I don't think we can make it more optimized than the compiler without writing ASM.
from bigint.
Say you have num1
and num2
as the two BigInt
operands. Then, if any one of them is found to be a power of 10 (say it's num1),
you can append the zeroes at once instead of using a loop, like so:
num2.value.append(num1.value.begin() + 1, num1.value.end());
This will certainly be much faster than simply carrying on with the multiplication.
from bigint.
I should've thought a little more about how I could utilize the BigInt objects first. I'm going to try both of those out right now.
from bigint.
Hi,would like to contribute. Should I implement it in math.hpp or create a separate file?
from bigint.
@Aakankshareddy The operators have already been defined in operators/binary_arithmetic.hpp
. You have to add checks within the definitions of the operators that are mentioned at the top, using a function named is_power_of_10()
, which you can define in functions/utilities.hpp
.
from bigint.
I gave it a try. Hope it is good enough.
The tests pass and run times also seem to have decreased, which is good.
from bigint.
Related Issues (20)
- 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
- Some BigInt relational operators are not optimal
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.