Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Runtime overflow and what to do
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Maxence Guesdon <maxence.guesdon@i...>
Subject: Re: [Caml-list] Runtime overflow and what to do
> 
> 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