flat assembler
Message board for the users of flat assembler.
Index
> Main > multiplication of longs(or even longer numbers) 
Author 

revolution
If you are willing to study a bit then I suggest you search for articles on Arbitrary Precision numbers. And don't forget about the Knuth books.
There is a lot of literature around on how to do various operations upon arbitrary precision numbers. 

26 Apr 2013, 10:15 

alessandro95
as bitRAKE told me in another thread there is a nice introduction on x86asm.net, they only deal with multiplication and division of an arbitrary size number by a machine word size number (32 bit in the examples but you can easily adapt them if you are writing 64 bit code), if you need operations between big numbers then I cannot help you :S (but maybe google can )


26 Apr 2013, 11:23 

fredlllll
the problem with the one on x86asm.net is, that it only shows the multiplication with 32bit ints. but i want for example multiply 2 1024 bit ints.
@revolution: well i dont want to buy a book just for that bit of knowledge. but ill look at that arbitrary precision thing. 

26 Apr 2013, 14:25 

revolution
fredlllll wrote: well i dont want to buy a book just for that bit of knowledge. ... Knowledge is one of the most precious things that I hold dear to me. 

26 Apr 2013, 14:36 

typedef
revolution wrote: Knowledge is one of the most precious things that I hold dear to me. How about sharing it heh So when you die, your knowledge will live on. 

26 Apr 2013, 19:55 

HaHaAnonymous
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 20:56; edited 1 time in total 

26 Apr 2013, 20:17 

alessandro95
I do not like the art of assembly but here he explains how to do long integer operations, he uses the algorithm they probably taught you in school, which should be fine for 1024 bit integers but if you are dealing with numbers that are several dozens if not hundreds of thousands of decimal digits long you may want to look at the SchÃ¶nhageStrassen algorithm for multiplication and you should find here some useful algorithms for fast divisions.
p.s. Don't ask me about the algorithm I linked, I only know that is widely used and pretty fast but I cannot understand all the maths involved 

27 Apr 2013, 01:31 

revolution
Before getting into the FFT stuff, one might be best going with Karatsuba first for the larger numbers. For many implementations, above ~10000100000 digits is when FFT becomes an overall win.


27 Apr 2013, 04:40 

< Last Thread  Next Thread > 
Forum Rules:

Copyright © 19992020, Tomasz Grysztar. Also on YouTube, Twitter.
Website powered by rwasa.