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: | Daniel de Rauglaudre <daniel.de_rauglaudre@i...> |
| Subject: | Re: [Caml-list] Runtime overflow and what to do |
Hi,
On Sun, Oct 13, 2002 at 12:29:58PM +0200, Pierre Weis wrote:
> let ( * ) n m =
> if num_bits_int n + num_bits_int m < length_of_int
> then n * m else raise (Overflow ("*", string_of_int n, string_of_int m))
Does it work with negative numbers? And with multiplication between a
positive and a negative number?
> Just to let people play with the writting of the module :),
> num_bits_int is left as an exercise to the interested readers (3 lines
> of Caml code using trivial bit shuffling).
I am interested in knowing it, because I already searched that.
Without a loop or a predefined array of powers of two, I don't
know how to do that.
--
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
-------------------
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