From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 6CA39BC69 for ; Tue, 1 May 2007 04:50:55 +0200 (CEST) Received: from ptb-relay01.plus.net (ptb-relay01.plus.net [212.159.14.212]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l412osou029282 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Tue, 1 May 2007 04:50:55 +0200 Received: from [80.229.56.224] (helo=beast.local) by ptb-relay01.plus.net with esmtp (Exim) id 1HiiS6-0001al-F7 for caml-list@yquem.inria.fr; Tue, 01 May 2007 03:50:54 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Int64 overflow checks Date: Tue, 1 May 2007 03:45:11 +0100 User-Agent: KMail/1.9.5 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200705010345.11909.jon@ffconsultancy.com> X-Miltered: at concorde with ID 4636AB0E.002 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 implicitly:01 'int':01 ocaml's:01 ocaml:01 fsharp:01 frog:98 wrote:01 overflows:01 integer:01 integer:01 caml-list:01 int:01 int:01 python:02 On Monday 30 April 2007 18:24, Raj B wrote: > Hi > > I am writing an implementation of the Python programming language in > OCaml and ran into an interesting issue. > > Python allows the programmer to implicitly perform arbitrary-sized > integer operations by switching internally between its 'int' and > 'long' types. (which seems to translate to OCaml's int64 and BigInt). > > I found an OCaml library on a mailing list which checks for overflow > in 'normal' 32-bit integer operations. How can I check for overflows > in int64 operations so I can switch to big-int if that happens? Sounds like a premature optimization. Just use Big_int for everything to start with... -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. The F#.NET Journal http://www.ffconsultancy.com/products/fsharp_journal/?e