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 discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 6282EBC69 for ; Mon, 30 Apr 2007 19:23:39 +0200 (CEST) Received: from mail.cs.rice.edu (mail.cs.rice.edu [128.42.1.31]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l3UHNcPQ027155 for ; Mon, 30 Apr 2007 19:23:39 +0200 Received: from mail.cs.rice.edu (localhost.localdomain [127.0.0.1]) by mail.cs.rice.edu (Postfix) with ESMTP id 8E21E2C2AB6 for ; Mon, 30 Apr 2007 12:23:37 -0500 (CDT) X-Virus-Scanned: by amavis-2.4.0 at mail.cs.rice.edu Received: from mail.cs.rice.edu ([127.0.0.1]) by mail.cs.rice.edu (mail.cs.rice.edu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id xWCR3S1-4RiX for ; Mon, 30 Apr 2007 12:23:36 -0500 (CDT) Received: from [10.249.109.2] (dunwlessnat.rice.edu [128.42.64.251]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by mail.cs.rice.edu (Postfix) with ESMTP id D07732C2A66 for ; Mon, 30 Apr 2007 12:23:36 -0500 (CDT) Mime-Version: 1.0 (Apple Message framework v750) Content-Transfer-Encoding: 7bit Message-Id: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: caml-list@yquem.inria.fr From: Raj B Subject: Int64 overflow checks Date: Mon, 30 Apr 2007 12:24:12 -0500 X-Mailer: Apple Mail (2.750) X-Miltered: at discorde with ID 4636261A.000 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 overflows:01 integer:01 integer:01 int:01 int:01 python:02 python:02 programming:03 seems:03 types:03 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? Thanks! Raj