Browse thread
Re: [Caml-list] Runtime overflow and what to do
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | John Carr <jfc@M...> |
| Subject: | Re: [Caml-list] Runtime overflow and what to do |
> If your problem is only the factorial function, then you can > calculate statically (i.e. at source-code writing time) the > value of the maximum integer whose factorial will fit in > O'Caml's representation of integers, and test against that, > once and for all, before entering the recursive calculation. OCaml supports 32 and 64 bit integers. Is it possible to detect at compile time the size of the maximum integer? In the case of factorial, you could almost as easily optimize the function to a table lookup. ------------------- 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