chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] Chicken segfaults with large-ish inputs


From: Sam Hardwick
Subject: [Chicken-users] Chicken segfaults with large-ish inputs
Date: Sat, 19 Feb 2011 23:47:42 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20101227 Icedove/3.0.11

Hello everyone - I have a bug report. I'm sending it here because someone on #chicken told me it's ok if I'm too lazy to register to the bug tracker. This is my solution to exercise 1.29 in SICP:

***

(define (sum term a next b)
  (if (> a b)
      0
      (+ (term a)
         (sum term (next a) next b))))

(define (adder n) (lambda (x) (+ x n)))

(define (integral f a b n)
  (let ((h (/ (- b a) n)))
    (define (y k) (f (+ a (* k h))))
    (*
     (/ h 3)
     (+ a b
        (* 4 (sum y 1 (adder 2) (- n 1)))
        (* 2 (sum y 2 (adder 2) (- n 2)))))))

***

When I exercise it with intervals divided into up to 100000 it works fine, but with eg.

***

(define (cube x) (* x x x))
(integral cube 0 1 1000000)

***

I get a segfault. This is (reportedly) remedied by compiling or using numbers (the module or whatever it's called).

I'm using the Chicken in Debian 6.0:

Version 4.5.0
linux-unix-gnu-x86 [ manyargs dload ptables ]
compiled 2010-06-17 on biber (Linux)

Although other people had the same problem on very recent versions as well (many other Scheme implementations also barf, some more elegantly, some less).

I'm not subscribed, so if you want to ask me anything, please reply to me directly.

Thanks,
Sam Hardwick



reply via email to

[Prev in Thread] Current Thread [Next in Thread]