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.9 required=5.0 tests=AWL,DNS_FROM_RFC_POST autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 47235BC0B for ; Thu, 7 Dec 2006 22:14:08 +0100 (CET) Received: from out3.smtp.messagingengine.com (out3.smtp.messagingengine.com [66.111.4.27]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id kB7LE7Dd015347 for ; Thu, 7 Dec 2006 22:14:08 +0100 Received: from out1.internal (unknown [10.202.2.149]) by out1.messagingengine.com (Postfix) with ESMTP id 51E8D4B597; Thu, 7 Dec 2006 16:14:05 -0500 (EST) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by out1.internal (MEProxy); Thu, 07 Dec 2006 16:14:05 -0500 X-Sasl-enc: 2EfKB/abySA32u10iRnB7AOBswwuw5zn86U1wyonnb3R 1165526044 Received: from [172.16.112.115] (burnham.ljcrf.edu [192.231.106.2]) by mail.messagingengine.com (Postfix) with ESMTP id 752FE17EAE; Thu, 7 Dec 2006 16:14:04 -0500 (EST) Date: Thu, 7 Dec 2006 13:13:19 -0800 (PST) From: Martin Jambon X-X-Sender: martin@localhost To: Pal-Kristian Engstad Cc: caml-list@inria.fr Subject: Re: [Caml-list] if (n:int) < 0 then (-n) > 0 is FALSE In-Reply-To: <45785E27.8050804@naughtydog.com> Message-ID: References: <45785E27.8050804@naughtydog.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-j-chkmail-Score: MSGID : 4578841F.002 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 4578841F.002 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; bug:01 1977:98 wrote:01 caml-list:01 int:01 jambon:01 jambon:01 loops:02 loops:02 caml:02 represented:02 silently:02 pal-kristian:03 overflow:03 engstad:04 On Thu, 7 Dec 2006, Pal-Kristian Engstad wrote: > To find that it loops forever. The reason is that 1024*1024*1024=2^30 > cannot be represented as a positive number on 32-bit platforms, hence it > silently converts it to -1073741824, or -2^30. The reason this loops > again is that -n = -(-20^30) = -20^30......, still negative! > > This is obviously a bug - has it since been fixed? But more alarmingly - > why is there no warning? For what it's worth, you can have a look at "Overflow": http://sebastien.ailleret.perso.cegetel.net/caml/ (I haven't tried it) Martin -- Martin Jambon, PhD http://martin.jambon.free.fr