#include <stdio.h>
int oddinverse(int x) { int t = x, i; x += 2; // repeat this lg(lg(MAXUINT+1))-1 times for (i = 4; i; i *= i) x *= t*x + 2; return -x; }
#define A 48 #define K 3 #define N 4
void main() { int C = oddinverse(K); // This divides A by (K*2^N) if K is odd and A/K is known to be whole. // It's only useful when K is known in advance, making C precomputable. // The method of division: Multiply by C and then shift right by N. printf("%d/(%d*2^%d)=%d\n", A, K, N, (A*C)>>N); } |