Tomcat web server - 3.2.1.1 ANSWERSTOEXERCISES 521 SECTION 3.2.1.1 1. Let c
3.2.1.1 ANSWERSTOEXERCISES 521 SECTION 3.2.1.1 1. Let c be a solution to the congruence UC E c (modulo m). (Thus, c = a c mod m, if a is the number in the answer to exercise 3.2.1-5.) Then we have LDA X ADD CPRIME MULA I Overflow is possible on this addition operation. (From results derived later in the chapter, it is probably best to save a unit of time, taking c = a and replacing the ADD instruction by INCA 1″. Then if X0 = 0, overflow will not occur until the end of the period, so it won t occur in practice.) 2.RANDM STJ 1F LDA XRAND MULA SLAX 5 ADD C (or, INCA c, if c is small) STA XRAND IH JNOV * JMP *-1 XRAND CON Xo A CON a C CON c I Note: Locations A and C should probably be named 2H and 3H to avoid conflict with other symbols, if this subroutine is to be used by other programmers. 3. See WMl at the end of Program 4.2.3D. 4. Define the operation z& 2 = y iff z E y (modulo 2e) and -2e- 5 y < 2e- The congruential sequence (Y,) defined by Y,=Xo&2 32 , Yn+l =(aY,+c)m&d232 is easy to compute on 370-style machines, since the lower half of the product of y and z is (yz) mod 232 for all two s complement numbers y and z, and since addition ignoring overflow also delivers its result &232. This sequence has all the random- ness properties of the standard linear congruential sequence (X,), since Y, G X, (modulo 232). Indeed, the two s complement representation of Y, is identical to the binary representation of X,, for all n. [G. Marsaglia and T. A. Bray first pointed this out in CACM 11 (1968), 757-759.1 5. (a) Subtraction: LDA X; SUB Y; JANN *+2; ADD M. (b) Addition: LDA X; SUB M; ADD Y; JANN *+2; ADD M. (Note that if m is more than half the word size, the instruction SUB M must precede the instruction ADD Y .) 6. The sequences are not essentially different, since adding the constant (m -c) has the same effect as subtracting the constant c. The operation must be combined with multiplication, so a subtractive process has little merit over the additive one (at least in MIX s case), except when it is necessary to avoid affecting the overflow toggle.
If you are in need for cheap and reliable webhost to host your website, we recommend http web server services.