From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA21731; Sun, 13 Oct 2002 12:47:53 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA21696 for ; Sun, 13 Oct 2002 12:47:53 +0200 (MET DST) Received: from verdot.inria.fr (verdot.inria.fr [128.93.11.7]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g9DAlq521641 for ; Sun, 13 Oct 2002 12:47:52 +0200 (MET DST) Received: (from ddr@localhost) by verdot.inria.fr (8.9.3/8.9.3) id MAA17273 for caml-list@inria.fr; Sun, 13 Oct 2002 12:47:52 +0200 Date: Sun, 13 Oct 2002 12:47:52 +0200 From: Daniel de Rauglaudre To: caml-list@inria.fr Subject: Re: [Caml-list] Runtime overflow and what to do Message-ID: <20021013124752.H7639@verdot.inria.fr> References: <20021013120456.D7639@verdot.inria.fr> <200210131029.MAA17141@pauillac.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200210131029.MAA17141@pauillac.inria.fr>; from pierre.weis@inria.fr on Sun, Oct 13, 2002 at 12:29:58PM +0200 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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