Trouble understanding FPREM1 in HLA



Hi again. Still chipping away at AoA.

Vol.3 - Chapter 11 in the chapter on Real Arithmetic we are introduced
to FPREM1: Partial Remainders.

It is explained that if the difference of the exponents of the
two numbers are less than 64, this operation will compute the exact
remainder in one go. But otherwise the operation may take two or
three swings before the job gets done.

C2 is set until the remainder is calculated. The author says,

"The C3, C1 and C0 get bits zero, one and two of the quotient
respectively" I don't understand that part: What is the
significance of these condition bits being set like that?

This might be why I am also having trouble with the example he gives:

// compute Z:= X mod Y

fld(Y);
fld(X);
repeat
fprem1();
fstsw (ax); // Get Condition code bits into AX
and (1, ah); // See if C2 is set.
until (@Z); // repeat until C2 is clear.
fstp (Z); // Store away remainder.
fstp (st0); // Pop old Y value.

Now the part I don't understand is the "and (1, ah);" intstruction. I
know you want to test the C2 bit to see if it's zero. I understand
that. But I don't understand how this instruction does that.

C2 is the 10th bit in ax; the #2 bit in ah. "anding" ah with 1 is
only testing the L.O. bit in ah, (the C0 bit). How does it test the
other bits? The instruction doesn't seem to take account of the other
bits that might be set in that instruction.

Anyway, assistance in understanding this is greatly appreciated.

Thanks.

.



Relevant Pages

  • Re: primality
    ... depending on the instruction, ... equivalent to dividing it by 10 and using the remainder. ... digit than to do a division. ... converting the number to a string before looking at the ...
    (sci.crypt)
  • Re: primality
    ... as, depending on the instruction, even in a single cycle. ... significant digit than to do a division. ... converting the number to a string before looking ... instead of one division to get the remainder, ...
    (sci.crypt)
  • Re: Newbie Worldcon non-report
    ... N for each city, without getting into a repeating pattern. ... years, in years divisible by 8, second tier cities all repeat every ... 16 years in years with a remainder of 1 when divided by 8, ...
    (rec.arts.sf.fandom)
  • Re: Using Split Inside Join
    ... > XfuXXbaXr ... I'll repeat it anyway. ... > a remainder. ... > fuXbaXr ...
    (comp.lang.perl.misc)
  • Re: modular arithmetic
    ... Robert wrote: ... find the remainder of 3^25 divided by 36. ... Raise this to the 25th power mod 49 in a similar way. ... Repeat until ...
    (sci.math)