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 UAA08603; Thu, 10 Oct 2002 20:03:46 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA08583 for ; Thu, 10 Oct 2002 20:03:45 +0200 (MET DST) Received: from mel-rto6.wanadoo.fr (smtp-out-6.wanadoo.fr [193.252.19.25]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g9AI3iD04688; Thu, 10 Oct 2002 20:03:44 +0200 (MET DST) Received: from mel-rta10.wanadoo.fr (193.252.19.193) by mel-rto6.wanadoo.fr (6.5.007) id 3DA24D4D0020A638; Thu, 10 Oct 2002 20:03:44 +0200 Received: from iliana (80.13.248.160) by mel-rta10.wanadoo.fr (6.5.007) id 3DA24C0A0021748C; Thu, 10 Oct 2002 20:03:44 +0200 Received: from luther by iliana with local (Exim 3.36 #1 (Debian)) id 17zhoJ-0000VH-00; Thu, 10 Oct 2002 20:13:23 +0200 Date: Thu, 10 Oct 2002 20:13:23 +0200 To: Luc Maranget Cc: "Scott J, " , caml-list@inria.fr Subject: Re: [Caml-list] Runtime overflow and what to do Message-ID: <20021010181323.GA1922@iliana> References: <00bd01c2706d$e7cd68e0$0100a8c0@janxp> <200210101521.RAA0000032708@beaune.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200210101521.RAA0000032708@beaune.inria.fr> User-Agent: Mutt/1.4i From: Sven LUTHER Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, Oct 10, 2002 at 05:21:13PM +0200, Luc Maranget wrote: > > Hi, > > > > > > 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. > > > > Thx > > > > Scott > > > > > > There is no such feature as a Onoverflow goto, because > Ocaml (and not OCamel...) default integers are not << real >> integers, > but machine integers on some size (typically 31 or 63) bits. But it is the lower bit that is ignored, no, si i guess incrementing an ocaml integer by 1, correspond to incrementing the machine integer by two, and would set the overflow flag in the processor status register all the same, would it not ? The flag is then ignored, but it is set all the same, at least until it is overriden by some other calculation. Friendly, Sven Luther ------------------- 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