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: Scott J, <jscott@p...>
Subject: [Caml-list] Runtime overflow and what to do
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