home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / program / misc / mas / mashelp / sacd.def < prev    next >
Encoding:
Modula Definition  |  1989-10-06  |  1.9 KB  |  75 lines

  1.  
  2. (* SAC Digit definition module. *)
  3.  
  4. DEFINITION MODULE SACD;
  5.  
  6.  
  7. (* Import lists and Definitions *) 
  8.  
  9. FROM MASSTOR IMPORT LIST;
  10.  
  11.  
  12. VAR THETA, ZETA, DELTA, ETA, EPSIL: LIST;
  13.  
  14.     
  15.     TABP2: ARRAY[1..64] OF LIST;
  16.  
  17.     
  18. PROCEDURE BITRAN(): LIST;
  19. (*Bit, random.  b is a random bit, 0 or 1.*)
  20.  
  21.  
  22. PROCEDURE DEGCD(AL,BL: LIST; VAR CL,UL,VL: LIST);
  23. (*Digit extended greatest common divisor.  a and b are beta-integers,
  24. a ge b ge 0.  c=GCD(a,b), a beta-integer.  a*u+b*v=c, with
  25. ABS(u) le b/2c, ABS(v) le a/2c.*)
  26.  
  27.  
  28. PROCEDURE DGCD(AL,BL: LIST): LIST;
  29. (*Digit greatest common divisor.  a and b are beta-integers,
  30. a ge b ge 0.  c=GCD(a,b).*)
  31.  
  32.  
  33. PROCEDURE DLOG2(AL: LIST): LIST;
  34. (*Digit logarithm, base 2.  a is a beta-digit.  If a=0 then n=0.
  35. otherwise n=FLOOR(LOG2(ABS(a)))+1.*)
  36.  
  37.  
  38. PROCEDURE DPCC(AL1,AL2: LIST; VAR UL,ULP,VL,VLP: LIST);
  39. (*Digit partial cosequence calculation.  a1 and a2 are beta-integers,
  40. a1 ge a2 gt 0.  u, up, v and vp are the last cosequence elements
  41. of a1 and a2 which can be guaranteed to correspond to correct
  42. quotient digits.*)
  43.  
  44.  
  45. PROCEDURE DPR(AL,BL: LIST; VAR CL,DL: LIST);
  46. (*Digit product.  a and b are beta-digits.  c and d are the unique
  47. beta-digits such that a*b=c*beta+d and c*d ge 0.*)
  48.  
  49.  
  50. PROCEDURE DQR(AL1,AL0,BL: LIST; VAR QL,RL: LIST);
  51. (*Digit quotient and remainder.  a1, a0 and b are beta-integers with
  52. a1*a0 ge 0 and ABS(b) gt ABS(a1).  q is the integral part of
  53. (a1*beta+a0)/b and r is (a1*beta+a0)-b*q.  q and r are
  54. beta-integers.*)
  55.  
  56.  
  57. PROCEDURE DRAN(): LIST;
  58. (*Digit, random.  a is a random beta-digit.*)
  59.  
  60.  
  61. PROCEDURE DRANN(): LIST;
  62. (*Digit, random non-negative.  a is a random non-negative beta-digit.
  63. Caution, the low-order bits of a are not very random.*)
  64.  
  65.  
  66. PROCEDURE DSQRTF(AL: LIST; VAR BL,TL: LIST);
  67. (*Digit square root function.  a is a non-negative beta-integer.
  68. b is the floor function of the square root of a and t is the sign
  69. of a-b*b.*)
  70.  
  71.  
  72. END SACD.
  73.  
  74.  
  75.