  Thread: Interest in I4004

1.  Originally Posted by jim121049 Got it mostly figured out. P1 (R2,R3) points to the dividend. P3 (R6,R7) points to the divisor. P4 (R8,R9) points to the quotient.

I don't know what P2 (R4,R5) points to, but it's not the remainder. for example, when I divide 9999999 by 2, the register that P2 points to contains all zeros. When I divide 1000 by 3, the register that P2 points to contains 1000. When I divide 22 by 7, the register that P2 points to contains 600000. ???

The quotient is a 16 digit number with the decimal point in the middle. For example, dividing 9999999 by 2 gives 4999999500000000 which is 4999999.500000000

When 1000000 is divided by 3, P2 points to 1
When 100000 is divided by 3, P2 points to 10
When 10000 is divided by 3, P2 points to 100
When 1000 is divided by 3, P2 points to 1000
When 100 is divided by 3, P2 points to 10000
When 10 is divided by 3, P2 points to 100000
When 1 is divided by 3, P2 points to 1000000
I did some more experimenting. First, the quotient has it decimal point at half way. The divisor looks to be first divided by 10. The R register has the dividend pushed to the bottom end of the number if the result overflows, other wise it is 0.
So, reading high memory to low( which is how number are stored ) the dividend number 0000000460000000 is 4.6. The divisor 0000000200000000 looks like 2.0 but is really 0.2 the quotient will be 0000003200000000 or 32.0 ( note the 10* because the divisor is really 0.2 ). Underflows are just truncated.
Note, as I said the decimal point is assumed to be in the center. This is mainly important for divide!
Dwight  Reply With Quote

2. I thought I'd mention, the inputs are assumed to have a decimal point as well in the center ( except the /10 of the denominator ). For the most art, this makes little difference since the result is a ratio. Where it does make a difference is on the compliance of the values. It seems to make some difference. It does a poor check to make sure that the divider isn't bigger than the dividend. It does this by counting comparing the leading zeros. The remainder R, makes more sense when the decimal point is adjusted 8 places to the right for the remainder. As an example:
11.0 divided by 300.0 displays .36666666 with R = 0.2
On my calculator I multiply .36666666 by 30 and get 10.9999998. If I add 0.0000002 I get 11.0.
So the only thing that is confusing is that the divisor is divided by 10. But if the decimal point is in both the dividend and the divisor, the remainder is correct but shifted 7 places to the left.
So, the remainder is correct but you need to put the decimal point of the input data in the right place.
I think things work correctly if you assume the divisor is divided by 10 but maybe it makes more sense if you assume the dividend it multiplied by 10. It is getting to complicated for my head but the key is putting the decimal points in the input data, then the remainder makes sense.
Dwight  Reply With Quote Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•