* Long data in C on Alpha DEC
@ 1996-07-16 4:00 Yuri Sorkin
0 siblings, 0 replies; only message in thread
From: Yuri Sorkin @ 1996-07-16 4:00 UTC (permalink / raw)
To: Peter-Lawrence.Montgomery; +Cc: mersenne
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1996-07-16 4:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-07-16 4:00 Long data in C on Alpha DEC Yuri Sorkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox