[racket] Am I Missing Something? [HtDP 31.3.1]
Richard,
We're not looking for an explanation of why the two numbers are
different. We're looking for an explanation of why, on Luke's
machine, unlike anybody else's here, they _aren't_ different. Somehow
I don't think portability issues in DrRacket are anybody's homework
assignment. So if you have an explanation, please share. :)
Carl Eastlund
On Tue, Jan 4, 2011 at 3:22 PM, Richard Cleis <rcleis at mac.com> wrote:
> I can explain it, but I don't know if it's revealing a solution.
>
> rac
>
> On Jan 4, 2011, at 12:32 PM, Stephen Chang wrote:
>
>> I get results similar to Carl.
>>
>> Welcome to DrRacket, version 5.0.1.7 [3m].
>> Language: Intermediate Student.
>> #i-0.49746596003269394
>> #i-0.4974659600326953
>> #i-4974659600326939.0
>> #i-4974659600326953.0
>>> (equal? (sum (g-series #i1000)) (accu-sum (g-series #i1000)))
>> false
>>> (equal? (* 10e15 (sum (g-series #i1000))) (* 10e15 (accu-sum (g-series #i1000))))
>> false
>>>
>>
>>
>> Luke, can you post the output you get?
>>
>>
>>
>>
>> On Tue, Jan 4, 2011 at 10:57 AM, Carl Eastlund <cce at ccs.neu.edu> wrote:
>>>
>>> On Tue, Jan 4, 2011 at 9:38 AM, Luke Jordan <luke.jordan at gmail.com> wrote:
>>>> All that code came straight out of the text, except that I used if instead
>>>> of cond. The sum, accu-sum, and g-series defs are all given. In your
>>>
>>> Ah, yes, now I see where the accumulator-based sum is. Sorry, my mistake.
>>>
>>>> results I see a difference. When I run it at home it's the same. I can
>>>> even (equal? (sum (listof number)) (accu-sum (listof number))) and get true.
>>>
>>> No idea what's going on. Maybe someone else will have an idea.
>>>
>>> --Carl