commit b9ba3cb8db7ad2541ed923f8e80956f7230b2ac8
Author: Mattias Andrée <[email protected]>
AuthorDate: Sun Mar 6 21:48:04 2016 +0100
Commit: Mattias Andrée <[email protected]>
CommitDate: Sun Mar 6 21:48:04 2016 +0100
A description of the Karatsuba algorithm
Signed-off-by: Mattias Andrée <[email protected]>
diff --git a/src/zmul.c b/src/zmul.c
index 53e19f5..5b35d93 100644
--- a/src/zmul.c
+++ b/src/zmul.c
@@ -7,6 +7,12 @@ zmul(z_t a, z_t b, z_t c)
{
/*
* Karatsuba algorithm
+ *
+ * Basically, this how you were toughed to multiply large numbers
+ * by hand in school: 4010â
3020 = (4000 + 10)(3000 + 20) =
+ = 40â
30â
10â´ + (40â
20 + 30â
10)â
10² + 10â
20, but the
middle is
+ * optimised to only one multiplication:
+ * 40â
20 + 30â
10 = (40 + 10)(30 + 20) â 40â
30 â 10â
20.
*/
size_t m, m2;