On Nov 6, 2013, at 7:13 AM, Ben Duan <yfe...@gmail.com> wrote: > Thank you, Jens. I didn't know that the inexactness of floating point numbers > could make such a big difference.
>From HtDP/1e: (define JANUS (list #i31 #i2e+34 #i-1.2345678901235e+80 #i2749 #i-2939234 #i-2e+33 #i3.2e+270 #i17 #i-2.4e+270 #i4.2344294738446e+170 #i1 #i-8e+269 #i0 #i99)) ;; [List-of Number] -> Number ;; add numbers from left to right (check-expect (sumlr '(1 2 3)) 6) (define (sumlr l) (foldl + 0 l)) ;; [List-of Number] -> Number ;; add numbers from right to left (check-expect (sumrl '(1 2 3)) 6) (define (sumrl l) (foldr + 0 l)) Then apply the two functions to JANUS. Enjoy -- Matthias ____________________ Racket Users list: http://lists.racket-lang.org/users