From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA03377; Thu, 10 Oct 2002 17:11:23 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA02722 for ; Thu, 10 Oct 2002 17:11:22 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g9AFBL524862; Thu, 10 Oct 2002 17:11:21 +0200 (MET DST) Received: from santenay.inria.fr (santenay.inria.fr [128.93.8.59]) by pauillac.inria.fr (8.7.6/8.7.3) with SMTP id RAA03340; Thu, 10 Oct 2002 17:11:21 +0200 (MET DST) Date: Thu, 10 Oct 2002 17:11:20 +0200 From: Maxence Guesdon To: "Scott J," Cc: caml-list@inria.fr Subject: Re: [Caml-list] Runtime overflow and what to do Message-Id: <20021010171120.175e2dca.maxence.guesdon@inria.fr> In-Reply-To: <00bd01c2706d$e7cd68e0$0100a8c0@janxp> References: <00bd01c2706d$e7cd68e0$0100a8c0@janxp> Organization: INRIA X-Mailer: Sylpheed version 0.8.3claws (GTK+ 1.2.10; ) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > > suppose I use the following code for fact > > let rec fact n = if n <= 1 then 1 else n * fact (n - 1) ;; > > Because an integer number is represented by a fixed number of bytes I will > get a runtime overflow if n is chosen too large. > > Is there in Ocamel a workaround to cope with this problem . Something like " > Onoverflow goto .. " in imperative languages. Sorry, i replied too fast and did not answer your question, since you don't want to catch stack_overflow but be warned about an overflow during the computation of mult. I don't know how to do that. -- Maxence Guesdon ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners