News for hackers. Stuff that matters.
Re:Adding BigInts to V8 by tzs on Wednesday May 02, 2018 @09:11PM (#16982569)
Speaking of Karatsuba, in 1993 I wrote a C++ big integer package and used Karatsuba. I had some questions about how to use it when the two numbers being multiplied are not the same length. I did some experiments, and noticed hints at some patterns in the data I was seeing. I asked about this on sci.math, but as far as I know no one ever gave an explanation.

If anyone is curious and wants to figure this out, here's my old sci.math post [1].

[1] https://groups.google.com/d/msg/sci.math/MX3MLCQ0zzA/XTqUoZk...

Re:Adding BigInts to V8 by coldsauce on Thursday May 03, 2018 @12:12AM (#16983309)
Wow! I find it remarkable that you have had this question open for 25 years without a single answer.
Re:Adding BigInts to V8 by delinka on Thursday May 03, 2018 @09:10AM (#16985629)
"...the two numbers being multiplied are not the same length."

Do you mean as counted in bits? If so, prepend zeroes until they are the same length. Does this negatively affect the algorithm's results?

EDIT: When I say 'prepend' I mean on the MSB end. In typical arithmetic on paper, that'd be adding leading zeroes (prepending) onto the numbers.

Re:Adding BigInts to V8 by taejo on Friday May 04, 2018 @08:11AM (#16993907)
You can do that - it's the "textbook" solution - but you can probably do better by not making your inputs larger: in the worst case you're going from multiplying N digits by 1 digit to N digits by N digits.
Re:Adding BigInts to V8 by saagarjha on Friday May 04, 2018 @03:44AM (#16992874)
Might be something to do with caching or fitting operands in registers?
Re:Adding BigInts to V8 by gnulinux on Thursday May 03, 2018 @08:23AM (#16985296)
Did you eventually find an answer?