Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: Yuri Sorkin <sorkin@crl12.crl.com>
To: Peter-Lawrence.Montgomery@cwi.nl
Cc: mersenne@base.com
Subject: Long data in C on Alpha DEC
Date: 1996/07/16	[thread overview]
Message-ID: <Pine.SUN.3.91.960716215644.2609B-100000@crl12.crl.com> (raw)


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



                 reply	other threads:[~1996-07-16  4:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox