On 8/25/2010 2:49:21 PM, Christian Ziemski wrote:
>On 25.08.2010 18:22 veditinfo
>Listmanager wrote:
>> From: "peter rejto"
>>
>> #1=3%8
>> #1
>>
>> Vedit replied with 3.
>>
>>
>> Do I understand it correctly ? 3%8 means the integer part of the
>> remainder of 3 divided by 8. I get 0.
>
>'3' is correct.
Christian,
I am re reading your email. Of course, that I was after was the decimal equivalent of the fraction 3/8.
I am also re reading Carl's email. Certainly the Wirth reference is a nice one. I was glad to find it on Wikipedia. I was not so glad to find that all it says about the individual chapters are the titles. I take that for my problem only Chapter 3, Recursive Algorithms are needed.
So, I went ahead and improvised. Here is my pseudo code:
Let a and b be two given positive integers. (In other words, we will have to figure out the sign of the quotient later. I take this is Ted's philosophy)
Step 1. Define the successive remainders recursively by
r_0=a/b,
r_1=10*r_0%b,
and so on. That is to say,
r_(n+1)=10r_n%b, for n=0,1,2,3....
Step 2. Define the successive digits of the quotient by,
d_0=a/b,
d_1=10r_0/b
and so on. That is to say,
d_(n+1)= 10r_n/ for n=0,1,2,3...
Step 3. Put the digits together to get the actual quotient.
Specifically, set q=d_0. d_1 d_2.....
If this sounds reasonable to you, I would appreciate your suggestions about turning my pseudo code into exact Vedit codes.
Thanks as always.
peter

