Comments (6)
Surely Jason's code implements this via the operator overload starting in line 208 of uint128_t.cpp :
uint128_t uint128_t::operator*(const uint128_t & rhs) const{
...
By the way, you may be interested in the modified version of this operator overload that I wrote to solve a contest center puzzle, described in http://arthurvause.blogspot.co.uk/2017/05/three-pandigitals.html
from uint128_t.
I do long multiplication in uint128_t
and uint256_t
because these two types have fixed numbers of internal digits, and thus multiplication can be done in constant time. I have implemented long multiplication in integer
, but it is relatively slow, when compared to other algorithms, which is why I have a list of commented out multiplication methods that are implemented but not used.
from uint128_t.
For modulo and divisions, have you tried Barrett? There’s also other method which combines Newton Inversion with Barrett’s algorithm (Newton Division), there’s an interesting paper here comparing algorithms: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.111.9736&rep=rep1&type=pdf
from uint128_t.
Cool! Thanks! I'll get to it at some point.
from uint128_t.
I made a ton of additions/changes in https://github.com/Kronuz/uint_t lots of optimizations and quite a few algorithms
from uint128_t.
Nice!
from uint128_t.
Related Issues (14)
- Is this endian-independent? HOT 1
- [bug] Wrong implementation of operator+= with negative numbers HOT 7
- double/float conversion/operations HOT 1
- performance HOT 1
- why uint128_t? HOT 1
- can we please eliminate this compiler warning?
- Promote to C++ standard HOT 1
- any plans to add hash function HOT 1
- Why do uint128_t.h and uint128_t.cpp implement operator% differently? HOT 1
- This doesn't work HOT 3
- uint128_t name usage HOT 1
- How to allocate U128 to two U64? HOT 4
- How to use this in a project? HOT 3
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 uint128_t.