Browse Source

added another e to bitwise

remotes/origin/multiplication
fdai7930 11 months ago
parent
commit
1e59489b4d
  1. 6
      src/multiplication.c
  2. 3
      src/multiplication.h

6
src/multiplication.c

@ -219,7 +219,7 @@ float power_multi(float base, int exponent) {
return result; return result;
} }
int bitwise_multi(int num1, int num2) {
int bitwisee_multi(int num1, int num2) {
int result = 0; int result = 0;
while (num1) { while (num1) {
if (num1 & 1) { if (num1 & 1) {
@ -255,6 +255,10 @@ int karatsuba_multi(int num1, int num2) {
return ac * (int)pow(10, 2 * m2) + ad_bc * (int)pow(10, m2) + bd; return ac * (int)pow(10, 2 * m2) + ad_bc * (int)pow(10, m2) + bd;
} }
int multiply_by_riesel_prime(int num) {
return (num << 2) + (num << 3) - (num << 1) - num;
}

3
src/multiplication.h

@ -30,8 +30,9 @@ int fibonacci_multi(int num, int fib);
int repeated_division_multi(int num1, int num2); int repeated_division_multi(int num1, int num2);
int bernoulli_multi(int num, int bernoulli); int bernoulli_multi(int num, int bernoulli);
float power_multi(float base, int exponent); float power_multi(float base, int exponent);
int bitwise_multi(int num1, int num2);
int bitwisee_multi(int num1, int num2);
int karatsuba_multi(int num1, int num2); int karatsuba_multi(int num1, int num2);
int multiply_by_riesel_prime(int num);

Loading…
Cancel
Save