hyperbolic cube | Fagnano's Theorem | up
Newsgroups: sci.math.num-analysis,comp.lang.c
From: Joe Keane <jgk@netcom.com>
Subject: Re: How to compute a # Modulo-63 ???
Message-ID: <jgkDBFw1L.DK2@netcom.com>
Date: Sun, 9 Jul 1995 08:10:33 GMT
Here's some code:
int mod63(unsigned long x) /* x < 2^32 */
{
unsigned t;
t = (((x >> 12) + x) >> 10) + (x << 2);
t = ((t >> 6) + t + 3) & 0xFF;
return (t - (t >> 6)) >> 2;
}
Why does it work?
--
Joe Keane, amateur mathematician