From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1014db,dfc8a27a8ba1c564,start X-Google-Attributes: gid1014db,public X-Google-Thread: 1164f8,dfc8a27a8ba1c564,start X-Google-Attributes: gid1164f8,public From: Yuri Sorkin Subject: Long data in C on Alpha DEC Date: 1996/07/16 Message-ID: #1/1 X-Deja-AN: 169246692 to: Peter-Lawrence.Montgomery@cwi.nl cc: mersenne@base.com content-type: TEXT/PLAIN; charset=US-ASCII organization: CRL Dialup Internet Access mime-version: 1.0 newsgroups: comp.sys.dec,comp.lang.c As I am told, the 'long double' type uses 64-bit mantissa. And are proper standard functions (sinl,cosl,expl,logl)? On Mon, 8 Jul 1996 Peter-Lawrence.Montgomery@cwi.nl wrote: > On a machine with 64-bit integers, such as the DEC Alpha, > we might select one q near 2^63. Using ell = 16 > > > The Alpha lacks an integer divide instruction, but one can > compute a modular product with a few simple operations. > It has MULQ (multiply low) and UMULH (unsigned multiply high) instructions > If 0 <= a, b < q, and q * qinv == 1 (mod 2^64), then > > a * b = UMULH(a, b) * 2^64 + MULQ(a, b) > Let quot = MULQ(qinv, MULQ(a, b)) > Then q*quot == q * (qinv * (a * b)) == a * b (mod 2^64) > So q * quot = UMULH(q, quot) * 2^64 + MULQ(q, quot) > = UMULH(q, quot) * 2^64 + MULQ(a, b) > a * b - q * quot = 2^64 * (UMULH(a, b) - UMULH(q, quot)) > a * b/2^64 == UMULH(a, b) - UMULH(q, a*b*qinv mod 2^64) > > When b comes from a table, we can also look up b*qinv (mod 2^64). > Then one MULQ, two UMULH, and a few simple instructions > (such as checking whether which UMULH is larger) will > give us a * b / 2^64 mod q, which is as useful as a * b mod q. In order to use this possibility in C programms, what is order of bytes? Yuri Sorkin