[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] what's the best way to have MacPerl do proper long division?



At 3:32 PM 12/6/00, John W Baxter wrote:
>At 9:05 -0600 12/6/00, <CoDeReBeL@hotmail.com> wrote:
>>Aside from floating point computations on a computer being approximate, it's
>>possible to write a Perl program that will take two numbers and put them
>>through the division algorithm you learned in grade school
>
>I seem to recall the operations being approximate in grade school, as well.
>Rather more approximate than binary floating point, and rather
>unpredictably so.
>
>I suppose the "new math" (40 years old now) fixed that.
>
Gee, what I learned in the days of the 'old math' was as precise as one chose:

        150.2608695
      ______________
    23|3456.0000000
      -23
       --
       115
      -115
       ---
         06
         -0
         --
          60
         -46
          --
          140
         -138
          ---
            20
            -0
            --
            200
            184
            ---
             160
            -138
             ---
              220
             -207
              ---
               130
               115

                etc. ;-)

And I agree this could be done with a simple recursive Perl script. Takers?

1;



- Bruce

__Bruce_Van_Allen___Santa_Cruz_CA__

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org