Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Re: [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: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: [Caml-list] Runtime overflow and what to do

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.

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: